poke: use unsetInterestFilter on Face instead of shutdown

refs #4642

Change-Id: I7b73c7bcde0763226a15d465046db2f4b7bb9b05
diff --git a/tools/peek/ndnpoke/main.cpp b/tools/peek/ndnpoke/main.cpp
index 5cb0dda..976fcd7 100644
--- a/tools/peek/ndnpoke/main.cpp
+++ b/tools/peek/ndnpoke/main.cpp
@@ -165,9 +165,6 @@
   scheduler::Scheduler scheduler(io);
   NdnPoke program(face, keyChain, std::cin, options);
   try {
-    program.afterFinish.connect([&scheduler, &face] {
-        scheduler.scheduleEvent(2_s, [&face] { face.shutdown(); });
-      });
     program.start();
     face.processEvents(timeout);
   }
diff --git a/tools/peek/ndnpoke/ndnpoke.cpp b/tools/peek/ndnpoke/ndnpoke.cpp
index 512d75b..1bda0de 100644
--- a/tools/peek/ndnpoke/ndnpoke.cpp
+++ b/tools/peek/ndnpoke/ndnpoke.cpp
@@ -52,10 +52,10 @@
     m_wasDataSent = true;
   }
   else {
-    m_face.setInterestFilter(m_options.prefixName,
-                             bind(&NdnPoke::onInterest, this, _1, _2, dataPacket),
-                             nullptr,
-                             bind(&NdnPoke::onRegisterFailed, this, _1, _2));
+    m_registeredPrefix = m_face.setInterestFilter(m_options.prefixName,
+                                                  bind(&NdnPoke::onInterest, this, _1, _2, dataPacket),
+                                                  nullptr,
+                                                  bind(&NdnPoke::onRegisterFailed, this, _1, _2));
   }
 }
 
@@ -92,7 +92,8 @@
   catch (const Face::OversizedPacketError& e) {
     std::cerr << "Data exceeded maximum packet size" << std::endl;
   }
-  afterFinish();
+
+  m_face.unsetInterestFilter(m_registeredPrefix);
 }
 
 void
diff --git a/tools/peek/ndnpoke/ndnpoke.hpp b/tools/peek/ndnpoke/ndnpoke.hpp
index 8aa8740..f297f9d 100644
--- a/tools/peek/ndnpoke/ndnpoke.hpp
+++ b/tools/peek/ndnpoke/ndnpoke.hpp
@@ -59,9 +59,6 @@
     return m_wasDataSent;
   }
 
-public:
-  signal::Signal<NdnPoke> afterFinish;
-
 private:
   shared_ptr<Data>
   createDataPacket();
@@ -78,6 +75,7 @@
   std::istream& m_inStream;
   const PokeOptions& m_options;
 
+  const RegisteredPrefixId* m_registeredPrefix;
   bool m_wasDataSent;
 };