rib: Cancel expiration on unregistration
refs: #1902
Change-Id: I85a75370ecc3677c8a9ebf3a48f3c0857598da2d
diff --git a/rib/rib-entry.cpp b/rib/rib-entry.cpp
index 5043233..3e24275 100644
--- a/rib/rib-entry.cpp
+++ b/rib/rib-entry.cpp
@@ -25,8 +25,12 @@
#include "rib-entry.hpp"
+#include "core/logger.hpp"
+
#include <ndn-cxx/management/nfd-control-command.hpp>
+NFD_LOG_INIT("RibEntry");
+
namespace nfd {
namespace rib {
@@ -57,28 +61,11 @@
}
}
-bool
+void
RibEntry::eraseFace(const FaceEntry& face)
{
RibEntry::iterator it = std::find_if(begin(), end(), bind(&compareFaceIdAndOrigin, _1, face));
-
- if (it != m_faces.end())
- {
- if (it->flags & ndn::nfd::ROUTE_FLAG_CAPTURE)
- {
- m_nFacesWithCaptureSet--;
- }
-
- //cancel any scheduled event
- scheduler::cancel(it->getExpirationEvent());
-
- m_faces.erase(it);
- return true;
- }
- else
- {
- return false;
- }
+ eraseFace(it);
}
bool
@@ -124,6 +111,10 @@
m_nFacesWithCaptureSet--;
}
+ //cancel any scheduled event
+ NFD_LOG_TRACE("Cancelling expiration eventId: " << face->getExpirationEvent());
+ scheduler::cancel(face->getExpirationEvent());
+
return m_faces.erase(face);
}