core+daemon: eliminate scheduler::{schedule,cancel} wrappers
Also move core/global-io.hpp to daemon/global.hpp
Refs: #4528, #4883
Change-Id: I0b99029f1a19d7451aab57099cd3303b7eb42ff3
diff --git a/daemon/mgmt/rib-manager.cpp b/daemon/mgmt/rib-manager.cpp
index 1532627..8db60ab 100644
--- a/daemon/mgmt/rib-manager.cpp
+++ b/daemon/mgmt/rib-manager.cpp
@@ -47,8 +47,7 @@
const Name RibManager::LOCALHOP_TOP_PREFIX = "/localhop/nfd";
RibManager::RibManager(rib::Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain,
- ndn::nfd::Controller& nfdController, Dispatcher& dispatcher,
- ndn::util::Scheduler& scheduler)
+ ndn::nfd::Controller& nfdController, Dispatcher& dispatcher, Scheduler& scheduler)
: ManagerBase(MGMT_MODULE_NAME, dispatcher)
, m_rib(rib)
, m_keyChain(keyChain)
@@ -137,7 +136,7 @@
" origin=" << route.origin << " cost=" << route.cost);
if (expires) {
- auto event = m_scheduler.scheduleEvent(*expires, [=] { m_rib.onRouteExpiration(name, route); });
+ auto event = m_scheduler.schedule(*expires, [=] { m_rib.onRouteExpiration(name, route); });
route.setExpirationEvent(event);
NFD_LOG_TRACE("Scheduled unregistration at: " << *route.expires);
}
@@ -459,7 +458,7 @@
void
RibManager::scheduleActiveFaceFetch(const time::seconds& timeToWait)
{
- m_activeFaceFetchEvent = m_scheduler.scheduleEvent(timeToWait, [this] { fetchActiveFaces(); });
+ m_activeFaceFetchEvent = m_scheduler.schedule(timeToWait, [this] { fetchActiveFaces(); });
}
void
@@ -477,7 +476,7 @@
for (auto faceId : m_registeredFaces) {
if (activeFaceIds.count(faceId) == 0) {
NFD_LOG_DEBUG("Removing invalid face ID: " << faceId);
- m_scheduler.scheduleEvent(0_ns, [this, faceId] { this->onFaceDestroyedEvent(faceId); });
+ m_scheduler.schedule(0_ns, [this, faceId] { this->onFaceDestroyedEvent(faceId); });
}
}
@@ -492,7 +491,7 @@
if (notification.getKind() == ndn::nfd::FACE_EVENT_DESTROYED) {
NFD_LOG_DEBUG("Received notification for destroyed faceId: " << notification.getFaceId());
- m_scheduler.scheduleEvent(0_ns, [this, id = notification.getFaceId()] { onFaceDestroyedEvent(id); });
+ m_scheduler.schedule(0_ns, [this, id = notification.getFaceId()] { onFaceDestroyedEvent(id); });
}
}
diff --git a/daemon/mgmt/rib-manager.hpp b/daemon/mgmt/rib-manager.hpp
index 745cfa2..788a1d0 100644
--- a/daemon/mgmt/rib-manager.hpp
+++ b/daemon/mgmt/rib-manager.hpp
@@ -51,8 +51,7 @@
{
public:
RibManager(rib::Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain,
- ndn::nfd::Controller& nfdController, Dispatcher& dispatcher,
- ndn::util::Scheduler& scheduler);
+ ndn::nfd::Controller& nfdController, Dispatcher& dispatcher, Scheduler& scheduler);
/**
* @brief Apply localhost_security configuration.
@@ -246,14 +245,14 @@
ndn::KeyChain& m_keyChain;
ndn::nfd::Controller& m_nfdController;
Dispatcher& m_dispatcher;
- ndn::util::Scheduler& m_scheduler;
+ Scheduler& m_scheduler;
ndn::nfd::FaceMonitor m_faceMonitor;
ndn::ValidatorConfig m_localhostValidator;
ndn::ValidatorConfig m_localhopValidator;
bool m_isLocalhopEnabled;
- ndn::util::scheduler::ScopedEventId m_activeFaceFetchEvent;
+ scheduler::ScopedEventId m_activeFaceFetchEvent;
using FaceIdSet = std::set<uint64_t>;
FaceIdSet m_registeredFaces; ///< contains FaceIds with one or more Routes in the RIB
};