Skip to content

Commit

Permalink
full-producer: do not append hash of IBF to data name
Browse files Browse the repository at this point in the history
refs #5066

Change-Id: Ie74a9512e6795a02028c82c55484c009d3a3a11f
  • Loading branch information
yoursunny committed Jan 18, 2024
1 parent c052d89 commit 62f0800
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
37 changes: 10 additions & 27 deletions PSync/full-producer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2023, The University of Memphis
* Copyright (c) 2014-2024, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
Expand Down Expand Up @@ -254,38 +254,21 @@ FullProducer::onSyncInterest(const ndn::Name& prefixName, const ndn::Interest& i
void
FullProducer::sendSyncData(const ndn::Name& name, const ndn::Block& block)
{
NDN_LOG_DEBUG("Checking if data will satisfy our own pending interest");

ndn::Name nameWithIblt;
m_iblt.appendToName(nameWithIblt);

// TODO: Remove appending of hash - serves no purpose to the receiver
ndn::Name dataName(ndn::Name(name).appendNumber(std::hash<ndn::Name>{}(nameWithIblt)));
bool isSatisfyingOwnInterest = m_outstandingInterestName == name;
if (isSatisfyingOwnInterest && m_fetcher) {
NDN_LOG_DEBUG("Removing our pending interest from face (stop fetcher)");
m_fetcher->stop();
m_outstandingInterestName.clear();
}

NDN_LOG_DEBUG("Sending sync Data");
auto content = detail::compress(m_contentCompression, block);
m_segmentPublisher.publish(name, name, *content, m_syncReplyFreshness);

// checking if our own interest got satisfied
if (m_outstandingInterestName == name) {
NDN_LOG_DEBUG("Satisfied our own pending interest");
// remove outstanding interest
if (m_fetcher) {
NDN_LOG_DEBUG("Removing our pending interest from face (stop fetcher)");
m_fetcher->stop();
m_outstandingInterestName = ndn::Name("");
}

NDN_LOG_DEBUG("Sending sync Data");

// Send data after removing pending sync interest on face
m_segmentPublisher.publish(name, dataName, *content, m_syncReplyFreshness);

if (isSatisfyingOwnInterest) {
NDN_LOG_TRACE("Renewing sync interest");
sendSyncInterest();
}
else {
NDN_LOG_DEBUG("Sending sync Data");
m_segmentPublisher.publish(name, dataName, *content, m_syncReplyFreshness);
}
}

void
Expand Down
5 changes: 2 additions & 3 deletions tests/test-full-sync.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2023, The University of Memphis
* Copyright (c) 2014-2024, The University of Memphis
*
* This file is part of PSync.
* See AUTHORS.md for complete list of PSync authors and contributors.
Expand Down Expand Up @@ -500,8 +500,7 @@ BOOST_AUTO_TEST_CASE(DelayedSecondSegment)
// Get data name from face and increase segment number to form next interest
BOOST_REQUIRE(!faces[0]->sentData.empty());
Name dataName = faces[0]->sentData.front().getName();
Name interestName = dataName.getSubName(0, dataName.size() - 2);
interestName.appendSegment(1);
Name interestName = dataName.getPrefix(-1).appendSegment(1);
faces[0]->sentData.clear();

nodes[0]->onSyncInterest(syncPrefix, Interest(interestName));
Expand Down

0 comments on commit 62f0800

Please sign in to comment.