rib: stop using the global scheduler

Change-Id: I0e205e2f1adf85be49b132b47791b27e4530697a
Refs: #4528
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index 009b9ad..5ba99b8 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -27,7 +27,6 @@
 
 #include "core/fib-max-depth.hpp"
 #include "core/logger.hpp"
-#include "core/scheduler.hpp"
 
 #include <ndn-cxx/lp/tags.hpp>
 #include <ndn-cxx/mgmt/nfd/control-command.hpp>
@@ -44,19 +43,22 @@
 static const std::string MGMT_MODULE_NAME = "rib";
 static const Name LOCALHOST_TOP_PREFIX = "/localhost/nfd";
 static const Name LOCALHOP_TOP_PREFIX = "/localhop/nfd";
-static const time::seconds ACTIVE_FACE_FETCH_INTERVAL = time::seconds(300);
+static const time::seconds ACTIVE_FACE_FETCH_INTERVAL = 5_min;
 
 RibManager::RibManager(Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain,
-                       ndn::nfd::Controller& nfdController, Dispatcher& dispatcher)
+                       ndn::nfd::Controller& nfdController, Dispatcher& dispatcher,
+                       ndn::util::Scheduler& scheduler)
   : ManagerBase(dispatcher, MGMT_MODULE_NAME)
   , m_rib(rib)
   , m_keyChain(keyChain)
   , m_nfdController(nfdController)
   , m_dispatcher(dispatcher)
+  , m_scheduler(scheduler)
   , m_faceMonitor(face)
   , m_localhostValidator(face)
   , m_localhopValidator(face)
   , m_isLocalhopEnabled(false)
+  , m_activeFaceFetchEvent(m_scheduler)
 {
   registerCommandHandler<ndn::nfd::RibRegisterCommand>("register",
     bind(&RibManager::registerEntry, this, _2, _3, _4, _5));
@@ -135,8 +137,8 @@
                " origin=" << route.origin << " cost=" << route.cost);
 
   if (expires) {
-    route.setExpirationEvent(scheduler::schedule(
-      *expires, [=] { m_rib.onRouteExpiration(name, route); }));
+    auto event = m_scheduler.scheduleEvent(*expires, [=] { m_rib.onRouteExpiration(name, route); });
+    route.setExpirationEvent(event, m_scheduler);
     NFD_LOG_TRACE("Scheduled unregistration at: " << *route.expires);
   }
 
@@ -455,7 +457,7 @@
 void
 RibManager::scheduleActiveFaceFetch(const time::seconds& timeToWait)
 {
-  m_activeFaceFetchEvent = scheduler::schedule(timeToWait, [this] { this->fetchActiveFaces(); });
+  m_activeFaceFetchEvent = m_scheduler.scheduleEvent(timeToWait, [this] { fetchActiveFaces(); });
 }
 
 void
@@ -473,7 +475,7 @@
   for (auto faceId : m_registeredFaces) {
     if (activeFaceIds.count(faceId) == 0) {
       NFD_LOG_DEBUG("Removing invalid face ID: " << faceId);
-      scheduler::schedule(time::seconds(0), [this, faceId] { this->onFaceDestroyedEvent(faceId); });
+      m_scheduler.scheduleEvent(0_ns, [this, faceId] { this->onFaceDestroyedEvent(faceId); });
     }
   }
 
@@ -488,9 +490,7 @@
 
   if (notification.getKind() == ndn::nfd::FACE_EVENT_DESTROYED) {
     NFD_LOG_DEBUG("Received notification for destroyed faceId: " << notification.getFaceId());
-
-    scheduler::schedule(time::seconds(0),
-                        bind(&RibManager::onFaceDestroyedEvent, this, notification.getFaceId()));
+    m_scheduler.scheduleEvent(0_ns, [this, id = notification.getFaceId()] { onFaceDestroyedEvent(id); });
   }
 }