mgmt+rib: use getScheduler() in RibManager and Readvertise

Refs: #4528
Change-Id: Ie6dd2b0fbe5d57cd7878d86b0185ae5d9bd92cf0
diff --git a/daemon/rib/readvertise/readvertise.cpp b/daemon/rib/readvertise/readvertise.cpp
index 49c3400..d5bedf8 100644
--- a/daemon/rib/readvertise/readvertise.cpp
+++ b/daemon/rib/readvertise/readvertise.cpp
@@ -25,6 +25,7 @@
 
 #include "readvertise.hpp"
 #include "core/logger.hpp"
+#include "daemon/global.hpp"
 
 #include <ndn-cxx/util/random.hpp>
 
@@ -44,11 +45,10 @@
   return std::max(newTime, 0_ms);
 }
 
-Readvertise::Readvertise(Rib& rib, Scheduler& scheduler,
+Readvertise::Readvertise(Rib& rib,
                          unique_ptr<ReadvertisePolicy> policy,
                          unique_ptr<ReadvertiseDestination> destination)
-  : m_scheduler(scheduler)
-  , m_policy(std::move(policy))
+  : m_policy(std::move(policy))
   , m_destination(std::move(destination))
 {
   m_addRouteConn = rib.afterAddRoute.connect([this] (const auto& r) { this->afterAddRoute(r); });
@@ -162,14 +162,14 @@
     [=] {
       NFD_LOG_DEBUG("advertise " << rrIt->prefix << " success");
       rrIt->retryDelay = RETRY_DELAY_MIN;
-      rrIt->retryEvt = m_scheduler.schedule(randomizeTimer(m_policy->getRefreshInterval()),
-                                            [=] { advertise(rrIt); });
+      rrIt->retryEvt = getScheduler().schedule(randomizeTimer(m_policy->getRefreshInterval()),
+                                               [=] { advertise(rrIt); });
     },
     [=] (const std::string& msg) {
       NFD_LOG_DEBUG("advertise " << rrIt->prefix << " failure " << msg);
       rrIt->retryDelay = std::min(RETRY_DELAY_MAX, rrIt->retryDelay * 2);
-      rrIt->retryEvt = m_scheduler.schedule(randomizeTimer(rrIt->retryDelay),
-                                            [=] { advertise(rrIt); });
+      rrIt->retryEvt = getScheduler().schedule(randomizeTimer(rrIt->retryDelay),
+                                               [=] { advertise(rrIt); });
     });
 }
 
@@ -192,8 +192,8 @@
     [=] (const std::string& msg) {
       NFD_LOG_DEBUG("withdraw " << rrIt->prefix << " failure " << msg);
       rrIt->retryDelay = std::min(RETRY_DELAY_MAX, rrIt->retryDelay * 2);
-      rrIt->retryEvt = m_scheduler.schedule(randomizeTimer(rrIt->retryDelay),
-                                            [=] { withdraw(rrIt); });
+      rrIt->retryEvt = getScheduler().schedule(randomizeTimer(rrIt->retryDelay),
+                                               [=] { withdraw(rrIt); });
     });
 }
 
diff --git a/daemon/rib/readvertise/readvertise.hpp b/daemon/rib/readvertise/readvertise.hpp
index a14d438..871702f 100644
--- a/daemon/rib/readvertise/readvertise.hpp
+++ b/daemon/rib/readvertise/readvertise.hpp
@@ -43,9 +43,8 @@
  */
 class Readvertise : noncopyable
 {
-
 public:
-  Readvertise(Rib& rib, Scheduler& scheduler,
+  Readvertise(Rib& rib,
               unique_ptr<ReadvertisePolicy> policy,
               unique_ptr<ReadvertiseDestination> destination);
 
@@ -76,7 +75,6 @@
   static const time::milliseconds RETRY_DELAY_MIN;
   static const time::milliseconds RETRY_DELAY_MAX;
 
-  Scheduler& m_scheduler;
   unique_ptr<ReadvertisePolicy> m_policy;
   unique_ptr<ReadvertiseDestination> m_destination;
 
diff --git a/daemon/rib/service.cpp b/daemon/rib/service.cpp
index 8405c8e..043b980 100644
--- a/daemon/rib/service.cpp
+++ b/daemon/rib/service.cpp
@@ -107,11 +107,10 @@
                  const ConfigParseFunc& configParse)
   : m_keyChain(keyChain)
   , m_face(std::move(localNfdTransport), getGlobalIoService(), m_keyChain)
-  , m_scheduler(m_face.getIoService())
   , m_nfdController(m_face, m_keyChain)
   , m_fibUpdater(m_rib, m_nfdController)
   , m_dispatcher(m_face, m_keyChain)
-  , m_ribManager(m_rib, m_face, m_keyChain, m_nfdController, m_dispatcher, m_scheduler)
+  , m_ribManager(m_rib, m_face, m_keyChain, m_nfdController, m_dispatcher)
 {
   if (s_instance != nullptr) {
     NDN_THROW(std::logic_error("RIB service cannot be instantiated more than once"));
@@ -219,7 +218,6 @@
 
         m_readvertisePropagation = make_unique<Readvertise>(
           m_rib,
-          m_scheduler,
           make_unique<HostToGatewayReadvertisePolicy>(m_keyChain, item.second),
           make_unique<NfdRibReadvertiseDestination>(m_nfdController, m_rib, options, parameters));
       }
@@ -242,7 +240,6 @@
     auto options = ndn::nfd::CommandOptions().setPrefix(READVERTISE_NLSR_PREFIX);
     m_readvertiseNlsr = make_unique<Readvertise>(
       m_rib,
-      m_scheduler,
       make_unique<ClientToNlsrReadvertisePolicy>(),
       make_unique<NfdRibReadvertiseDestination>(m_nfdController, m_rib, options));
   }
diff --git a/daemon/rib/service.hpp b/daemon/rib/service.hpp
index 1c07d7e..d1c2226 100644
--- a/daemon/rib/service.hpp
+++ b/daemon/rib/service.hpp
@@ -111,7 +111,6 @@
 
   ndn::KeyChain& m_keyChain;
   ndn::Face m_face;
-  Scheduler m_scheduler;
   ndn::nfd::Controller m_nfdController;
 
   Rib m_rib;