src: schedule sync interest on NoRoute NACK

refs #5012

Change-Id: I671b507c66e1957aae976c859e81591c93dc4d94
This commit is contained in:
Ashlesh Gawande committed 2019-10-08 16:34:24 -05:00
1 parent dfd704aa4e
commit a1ad604672
2 files changed
+25 -1

No files matched your search

+13 -1
View File
@@ -368,6 +368,18 @@ Logic::onResetData(const Interest& interest, const Data& data)
// This should not happened, drop the received data.
}
void
Logic::onSyncNack(const Interest& interest, const ndn::lp::Nack& nack)
{
_LOG_DEBUG_ID(">> Logic::onSyncNack");
if (nack.getReason() == ndn::lp::NackReason::NO_ROUTE) {
auto after = ndn::time::milliseconds(m_reexpressionJitter(m_rng));
_LOG_DEBUG_ID("Schedule sync interest after: " << after);
m_scheduler.schedule(after, [this] { sendSyncInterest(); });
}
_LOG_DEBUG_ID("<< Logic::onSyncNack");
}
void
Logic::onSyncTimeout(const Interest& interest)
{
@@ -627,7 +639,7 @@ Logic::sendSyncInterest()
m_pendingSyncInterest = m_face.expressInterest(interest,
bind(&Logic::onSyncData, this, _1, _2),
bind(&Logic::onSyncTimeout, this, _1), // Nack
bind(&Logic::onSyncNack, this, _1, _2),
bind(&Logic::onSyncTimeout, this, _1));
_LOG_DEBUG_ID("Send interest: " << interest.getName());
+12
View File
@@ -291,6 +291,18 @@ private:
void
onResetData(const Interest& interest, const Data& data);
/**
* @brief Callback to handle Sync Interest Nack
*
* This method checks whether the Nack is of type NoRoute
* and schedules a sync interest in m_reexpressionJitter
*
* @param interest The sync interest for which the Nack happened
* @param nack The incoming Nack
*/
void
onSyncNack(const Interest& interest, const ndn::lp::Nack& nack);
/**
* @brief Callback to handle Sync Interest timeout.
*