face: making Face::shutdown call asynchronous
After Face::processInterestFilters changed to dispatch all callbacks
that match the configured filters, calling shutdown() from inside the
callback caused segfault (unexpected invalidation of the iterator).
Change-Id: Ia0a3048ce3574d354071e091c2d9400ad9a263b4
Refs: #1366
diff --git a/src/face.cpp b/src/face.cpp
index aec1cdf..fa0f24d 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -261,6 +261,12 @@
void
Face::shutdown()
{
+ m_ioService->post(bind(&Face::asyncShutdown, this));
+}
+
+void
+Face::asyncShutdown()
+{
m_pendingInterestTable.clear();
m_registeredPrefixTable.clear();
diff --git a/src/face.hpp b/src/face.hpp
index 4cb4c67..be1ca06 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -227,6 +227,8 @@
void
onReceiveElement(const Block& wire);
+ void
+ asyncShutdown();
static void
fireProcessEventsTimeout(const boost::system::error_code& error);