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/rib/readvertise/readvertise.cpp b/daemon/rib/readvertise/readvertise.cpp
index 454ab20..49c3400 100644
--- a/daemon/rib/readvertise/readvertise.cpp
+++ b/daemon/rib/readvertise/readvertise.cpp
@@ -44,7 +44,7 @@
return std::max(newTime, 0_ms);
}
-Readvertise::Readvertise(Rib& rib, ndn::util::Scheduler& scheduler,
+Readvertise::Readvertise(Rib& rib, Scheduler& scheduler,
unique_ptr<ReadvertisePolicy> policy,
unique_ptr<ReadvertiseDestination> destination)
: m_scheduler(scheduler)
@@ -162,14 +162,14 @@
[=] {
NFD_LOG_DEBUG("advertise " << rrIt->prefix << " success");
rrIt->retryDelay = RETRY_DELAY_MIN;
- rrIt->retryEvt = m_scheduler.scheduleEvent(randomizeTimer(m_policy->getRefreshInterval()),
- [=] { advertise(rrIt); });
+ rrIt->retryEvt = m_scheduler.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.scheduleEvent(randomizeTimer(rrIt->retryDelay),
- [=] { advertise(rrIt); });
+ rrIt->retryEvt = m_scheduler.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.scheduleEvent(randomizeTimer(rrIt->retryDelay),
- [=] { withdraw(rrIt); });
+ rrIt->retryEvt = m_scheduler.schedule(randomizeTimer(rrIt->retryDelay),
+ [=] { withdraw(rrIt); });
});
}
diff --git a/daemon/rib/readvertise/readvertise.hpp b/daemon/rib/readvertise/readvertise.hpp
index 80dbbc7..a14d438 100644
--- a/daemon/rib/readvertise/readvertise.hpp
+++ b/daemon/rib/readvertise/readvertise.hpp
@@ -45,8 +45,7 @@
{
public:
- Readvertise(Rib& rib,
- ndn::util::Scheduler& scheduler,
+ Readvertise(Rib& rib, Scheduler& scheduler,
unique_ptr<ReadvertisePolicy> policy,
unique_ptr<ReadvertiseDestination> destination);
@@ -77,7 +76,7 @@
static const time::milliseconds RETRY_DELAY_MIN;
static const time::milliseconds RETRY_DELAY_MAX;
- ndn::util::Scheduler& m_scheduler;
+ Scheduler& m_scheduler;
unique_ptr<ReadvertisePolicy> m_policy;
unique_ptr<ReadvertiseDestination> m_destination;
diff --git a/daemon/rib/readvertise/readvertised-route.hpp b/daemon/rib/readvertise/readvertised-route.hpp
index 7dc02ae..3749336 100644
--- a/daemon/rib/readvertise/readvertised-route.hpp
+++ b/daemon/rib/readvertise/readvertised-route.hpp
@@ -52,7 +52,7 @@
mutable ndn::security::SigningInfo signer; ///< signer for commands
mutable size_t nRibRoutes; ///< number of RIB routes that cause the readvertisement
mutable time::milliseconds retryDelay; ///< retry interval (not used for refresh)
- mutable ndn::util::scheduler::ScopedEventId retryEvt; ///< retry or refresh event
+ mutable scheduler::ScopedEventId retryEvt; ///< retry or refresh event
};
inline bool
diff --git a/daemon/rib/route.hpp b/daemon/rib/route.hpp
index f38fbab..92df470 100644
--- a/daemon/rib/route.hpp
+++ b/daemon/rib/route.hpp
@@ -53,14 +53,14 @@
*/
Route(const ndn::PrefixAnnouncement& ann, uint64_t faceId);
- const ndn::util::scheduler::EventId&
+ const scheduler::EventId&
getExpirationEvent() const
{
return m_expirationEvent;
}
void
- setExpirationEvent(const ndn::util::scheduler::EventId& eid)
+ setExpirationEvent(const scheduler::EventId& eid)
{
m_expirationEvent = eid;
}
@@ -101,7 +101,7 @@
time::steady_clock::TimePoint annExpires;
private:
- ndn::util::scheduler::EventId m_expirationEvent;
+ scheduler::EventId m_expirationEvent;
};
bool
diff --git a/daemon/rib/service.cpp b/daemon/rib/service.cpp
index 35c092d..8405c8e 100644
--- a/daemon/rib/service.cpp
+++ b/daemon/rib/service.cpp
@@ -31,8 +31,8 @@
#include "readvertise/nfd-rib-readvertise-destination.hpp"
#include "readvertise/readvertise.hpp"
-#include "core/global-io.hpp"
#include "core/logger.hpp"
+#include "daemon/global.hpp"
#include <boost/property_tree/info_parser.hpp>
#include <ndn-cxx/transport/tcp-transport.hpp>
diff --git a/daemon/rib/service.hpp b/daemon/rib/service.hpp
index fe9b110..1c07d7e 100644
--- a/daemon/rib/service.hpp
+++ b/daemon/rib/service.hpp
@@ -111,7 +111,7 @@
ndn::KeyChain& m_keyChain;
ndn::Face m_face;
- ndn::util::Scheduler m_scheduler;
+ Scheduler m_scheduler;
ndn::nfd::Controller m_nfdController;
Rib m_rib;