src: schedule sync interest on NoRoute NACK
refs #5012
Change-Id: I671b507c66e1957aae976c859e81591c93dc4d94
diff --git a/src/logic.cpp b/src/logic.cpp
index 12b6feb..a8cd68e 100644
--- a/src/logic.cpp
+++ b/src/logic.cpp
@@ -369,6 +369,18 @@
}
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)
{
// It is OK. Others will handle the time out situation.
@@ -627,7 +639,7 @@
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());