face: Fixing small bug: after unregistering prefix, close transport if
there are no outstanding interests and prefix table is empty
Change-Id: Ie1a121fb34dfdeb10258e1ac46a8be1c9b7cdca9
diff --git a/src/face.cpp b/src/face.cpp
index 7e62fe4..fc064f1 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -167,13 +167,27 @@
if (i != registeredPrefixTable_.end())
{
m_fwController->selfDeregisterPrefix((*i)->getPrefix(),
- bind(&RegisteredPrefixTable::erase, ®isteredPrefixTable_, i),
+ bind(&Face::finalizeUnsertInterestFilter, this, i),
Controller::FailCallback());
}
// there cannot be two registered prefixes with the same id. if there are, then something is broken
}
+void
+Face::finalizeUnsertInterestFilter(RegisteredPrefixTable::iterator item)
+{
+ registeredPrefixTable_.erase(item);
+
+ if (!pitTimeoutCheckTimerActive_ && registeredPrefixTable_.empty())
+ {
+ transport_->close();
+ if (!ioServiceWork_) {
+ processEventsTimeoutTimer_->cancel();
+ }
+ }
+}
+
void
Face::processEvents(Milliseconds timeout/* = 0 */, bool keepThread/* = false*/)
{