Recalculate routing table after face destroy event
refs: #2635
Change-Id: I7abbb638515af4a55c4241c4242a496a8cf8ca88
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index eb06be0..c77cbf8 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -277,15 +277,25 @@
void
Nlsr::onFaceEventNotification(const ndn::nfd::FaceEventNotification& faceEventNotification)
{
+ _LOG_TRACE("Nlsr::onFaceEventNotification called");
ndn::nfd::FaceEventKind kind = faceEventNotification.getKind();
- _LOG_DEBUG("Nlsr::onFaceEventNotification called");
+
if (kind == ndn::nfd::FACE_EVENT_DESTROYED) {
uint64_t faceId = faceEventNotification.getFaceId();
- Adjacent *adjacent = m_adjacencyList.findAdjacent(faceId);
- if (adjacent != 0) {
- _LOG_DEBUG("Face to " << adjacent->getName() << " with face id: "
- << faceId << " deleted");
+
+ Adjacent* adjacent = m_adjacencyList.findAdjacent(faceId);
+
+ if (adjacent != nullptr) {
+ _LOG_DEBUG("Face to " << adjacent->getName() << " with face id: " << faceId << " destroyed");
+
adjacent->setFaceId(0);
+ adjacent->setStatus(Adjacent::STATUS_INACTIVE);
+
+ // A new adjacency LSA cannot be built until the neighbor is marked INACTIVE and
+ // has met the HELLO retry threshold
+ adjacent->setInterestTimedOutNo(m_confParam.getInterestRetryNumber());
+
+ m_nlsrLsdb.scheduleAdjLsaBuild();
}
}
}