src: Lsa interest retransmission in case of timeout
Refs: #1634
Change-Id: Iceeb6921bcc360de50714d227e8f12c4d0514115
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index 9a2afab..c970472 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -724,7 +724,8 @@
void
-Lsdb::expressInterest(const ndn::Name& interestName, uint32_t interestLifeTime)
+Lsdb::expressInterest(const ndn::Name& interestName, uint32_t interestLifeTime,
+ uint32_t timeoutCount)
{
std::cout << "Expressing Interest :" << interestName << std::endl;
_LOG_DEBUG("Expressing Interest for LSA(name): " << interestName);
@@ -735,7 +736,7 @@
ndn::bind(&Lsdb::processContent,
this, _1, _2),
ndn::bind(&Lsdb::processInterestTimedOut,
- this, _1));
+ this, _1, timeoutCount));
}
void
@@ -931,11 +932,17 @@
}
void
-Lsdb::processInterestTimedOut(const ndn::Interest& interest)
+Lsdb::processInterestTimedOut(const ndn::Interest& interest, uint32_t timeoutCount)
{
const ndn::Name& interestName(interest.getName());
- cout << "Interest timed out for LSA(name): " << interestName << endl;
_LOG_DEBUG("Interest timed out for LSA(name): " << interestName);
+ if ((timeoutCount + 1) <= m_nlsr.getConfParameter().getInterestRetryNumber()) {
+ _LOG_DEBUG("Interest timeoutCount: " << (timeoutCount + 1));
+ _LOG_DEBUG("Need to express interest again for LSA(name): " << interestName);
+ expressInterest(interestName,
+ m_nlsr.getConfParameter().getInterestResendTime(),
+ timeoutCount + 1);
+ }
}
ndn::time::system_clock::TimePoint