rib: Switching to use global IO

Change-Id: I5eca302c65d868810bd59ab654b7ea74762dc7ee
diff --git a/rib/main.cpp b/rib/main.cpp
index 452b8a9..1593784 100644
--- a/rib/main.cpp
+++ b/rib/main.cpp
@@ -28,6 +28,7 @@
 #include "common.hpp"
 #include "rib-manager.hpp"
 #include "core/config-file.hpp"
+#include "core/global-io.hpp"
 #include "core/logger.hpp"
 
 namespace nfd {
@@ -97,12 +98,6 @@
     config.parse(configFile, false);
   }
 
-  boost::asio::io_service&
-  getIoService()
-  {
-    return m_ribManager->getIoService();
-  }
-
   static void
   printUsage(std::ostream& os, const std::string& programName)
   {
@@ -184,7 +179,7 @@
     if (signalNo == SIGINT ||
         signalNo == SIGTERM)
       {
-        getIoService().stop();
+        getGlobalIoService().stop();
         NFD_LOG_INFO("Caught signal '" << strsignal(signalNo) << "', exiting...");
       }
     else
@@ -243,7 +238,7 @@
     return 2;
   }
 
-  boost::asio::signal_set signalSet(nrdInstance.getIoService());
+  boost::asio::signal_set signalSet(nfd::getGlobalIoService());
   signalSet.add(SIGINT);
   signalSet.add(SIGTERM);
   signalSet.add(SIGHUP);
@@ -253,7 +248,7 @@
                             boost::ref(signalSet)));
 
   try {
-    nrdInstance.getIoService().run();
+    nfd::getGlobalIoService().run();
   }
   catch (std::exception& e) {
     NFD_LOG_FATAL(e.what());
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index 27f7f3c..6cb0d6b 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -24,6 +24,7 @@
  **/
 
 #include "rib-manager.hpp"
+#include "core/global-io.hpp"
 #include "core/logger.hpp"
 
 namespace nfd {
@@ -56,8 +57,14 @@
                      ),
   };
 
+inline static void
+NullDeleter(boost::asio::io_service* variable)
+{
+  // do nothing
+}
+
 RibManager::RibManager()
-  : m_face(new ndn::Face())
+  : m_face(new ndn::Face(shared_ptr<boost::asio::io_service>(&getGlobalIoService(), &NullDeleter)))
   , m_nfdController(new ndn::nfd::Controller(*m_face))
   , m_validator(m_face)
   , m_faceMonitor(*m_face)
@@ -296,13 +303,6 @@
     bind(&RibManager::onCommandError, this, _1, _2, request, options));
 }
 
-boost::asio::io_service&
-RibManager::getIoService()
-{
-  /// \todo Switch face to use global io service (needs library update)
-  return *m_face->ioService();
-}
-
 void
 RibManager::onControlHeaderSuccess()
 {
diff --git a/rib/rib-manager.hpp b/rib/rib-manager.hpp
index 9479291..40b5818 100644
--- a/rib/rib-manager.hpp
+++ b/rib/rib-manager.hpp
@@ -57,9 +57,6 @@
   void
   enableLocalControlHeader();
 
-  boost::asio::io_service&
-  getIoService();
-
   void
   setConfigFile(ConfigFile& configFile);
 
diff --git a/wscript b/wscript
index 61bc03f..440b04d 100644
--- a/wscript
+++ b/wscript
@@ -170,7 +170,7 @@
 
     bld(features='subst',
         source='tools/nfd-status-http-server.py',
-        target='nfd-status-http-server',
+        target='bin/nfd-status-http-server',
         install_path="${BINDIR}",
         chmod=0755)