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/tests/daemon/fw/asf-measurements.t.cpp b/tests/daemon/fw/asf-measurements.t.cpp
index cc4c9e4..71491b7 100644
--- a/tests/daemon/fw/asf-measurements.t.cpp
+++ b/tests/daemon/fw/asf-measurements.t.cpp
@@ -24,6 +24,7 @@
*/
#include "fw/asf-measurements.hpp"
+#include "daemon/global.hpp"
#include "tests/daemon/face/dummy-face.hpp"
#include "tests/test-common.hpp"
@@ -85,7 +86,7 @@
{
FaceInfo info;
- scheduler::EventId id = scheduler::schedule(time::seconds(1), []{});
+ auto id = getScheduler().schedule(1_s, []{});
ndn::Name interestName("/ndn/interest");
// Receive Interest and forward to next hop; should update RTO information
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index 80e2603..83f9903 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -24,6 +24,7 @@
*/
#include "fw/best-route-strategy2.hpp"
+#include "daemon/global.hpp"
#include "tests/test-common.hpp"
#include "tests/daemon/face/dummy-face.hpp"
@@ -108,17 +109,17 @@
size_t nSent = strategy.sendInterestHistory.size();
if (nSent > nSentLast) {
BOOST_CHECK_EQUAL(nSent - nSentLast, 1);
- time::steady_clock::TimePoint timeSent = time::steady_clock::now();
+ auto timeSent = time::steady_clock::now();
BOOST_CHECK_GE(timeSent - timeSentLast, TICK * 8);
nSentLast = nSent;
timeSentLast = timeSent;
}
- retxFrom4Evt = scheduler::schedule(TICK * 5, periodicalRetxFrom4);
+ retxFrom4Evt = getScheduler().schedule(TICK * 5, periodicalRetxFrom4);
};
periodicalRetxFrom4();
this->advanceClocks(TICK, BestRouteStrategy2::RETX_SUPPRESSION_MAX * 16);
- scheduler::cancel(retxFrom4Evt);
+ retxFrom4Evt.cancel();
// nexthops for accepted retransmissions: follow FIB cost,
// later forward to an eligible upstream with earliest out-record
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 2c7c1d2..60c8ea4 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -24,6 +24,7 @@
*/
#include "fw/forwarder.hpp"
+#include "daemon/global.hpp"
#include "tests/test-common.hpp"
#include "tests/daemon/face/dummy-face.hpp"
@@ -545,7 +546,7 @@
face2->afterSend.connect([face1, face2] (uint32_t pktType) {
if (pktType == tlv::Interest) {
auto interest = make_shared<Interest>(face2->sentInterests.back());
- scheduler::schedule(time::milliseconds(170), [face1, interest] { face1->receiveInterest(*interest); });
+ getScheduler().schedule(170_ms, [face1, interest] { face1->receiveInterest(*interest); });
}
});
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 1ee1ae9..e3ed88b 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -24,10 +24,11 @@
*/
#include "fw/multicast-strategy.hpp"
-#include "strategy-tester.hpp"
-#include "tests/daemon/face/dummy-face.hpp"
+#include "daemon/global.hpp"
+#include "tests/daemon/face/dummy-face.hpp"
#include "tests/test-common.hpp"
+#include "strategy-tester.hpp"
namespace nfd {
namespace fw {
@@ -108,17 +109,17 @@
if (nSent > nSentLast) {
// Multicast strategy should multicast the interest to other two faces
BOOST_CHECK_EQUAL(nSent - nSentLast, 2);
- time::steady_clock::TimePoint timeSent = time::steady_clock::now();
+ auto timeSent = time::steady_clock::now();
BOOST_CHECK_GE(timeSent - timeSentLast, TICK * 8);
nSentLast = nSent;
timeSentLast = timeSent;
}
- retxFrom4Evt = scheduler::schedule(TICK * 5, periodicalRetxFrom4);
+ retxFrom4Evt = getScheduler().schedule(TICK * 5, periodicalRetxFrom4);
};
periodicalRetxFrom4();
this->advanceClocks(TICK, MulticastStrategy::RETX_SUPPRESSION_MAX * 16);
- scheduler::cancel(retxFrom4Evt);
+ retxFrom4Evt.cancel();
}
BOOST_AUTO_TEST_CASE(RejectLoopback)
diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp
index 1b71aa2..4044251 100644
--- a/tests/daemon/fw/ncc-strategy.t.cpp
+++ b/tests/daemon/fw/ncc-strategy.t.cpp
@@ -24,12 +24,10 @@
*/
#include "fw/ncc-strategy.hpp"
+
+#include "tests/daemon/face/dummy-face.hpp"
#include "strategy-tester.hpp"
#include "topology-tester.hpp"
-#include "tests/daemon/face/dummy-face.hpp"
-#include "tests/limited-io.hpp"
-
-#include "tests/test-common.hpp"
namespace nfd {
namespace fw {
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 86c47f6..3d61452 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -31,12 +31,11 @@
#include "fw/best-route-strategy2.hpp"
#include "fw/multicast-strategy.hpp"
-#include "tests/test-common.hpp"
-#include "tests/limited-io.hpp"
#include "choose-strategy.hpp"
#include "strategy-tester.hpp"
#include "topology-tester.hpp"
#include "tests/daemon/face/dummy-face.hpp"
+
#include <boost/mpl/vector.hpp>
namespace nfd {
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index 3c5be6b..6e8aa8a 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.t.cpp
@@ -34,11 +34,10 @@
#include "fw/best-route-strategy2.hpp"
#include "fw/multicast-strategy.hpp"
-#include "tests/test-common.hpp"
-#include "tests/limited-io.hpp"
#include "choose-strategy.hpp"
#include "strategy-tester.hpp"
#include "tests/daemon/face/dummy-face.hpp"
+
#include <boost/mpl/copy_if.hpp>
#include <boost/mpl/vector.hpp>
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index 984c792..c97e8ab 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.t.cpp
@@ -35,11 +35,10 @@
#include "fw/multicast-strategy.hpp"
#include "fw/ncc-strategy.hpp"
-#include "tests/test-common.hpp"
-#include "tests/limited-io.hpp"
#include "choose-strategy.hpp"
#include "strategy-tester.hpp"
#include "tests/daemon/face/dummy-face.hpp"
+
#include <boost/mpl/copy_if.hpp>
#include <boost/mpl/vector.hpp>
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index 5b5c98d..f2ac93d 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -27,7 +27,8 @@
#define NFD_TESTS_DAEMON_FW_STRATEGY_TESTER_HPP
#include "fw/strategy.hpp"
-#include "tests/limited-io.hpp"
+
+#include "tests/daemon/limited-io.hpp"
namespace nfd {
namespace fw {
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index 15bbc3c..c401aef 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -24,6 +24,7 @@
*/
#include "topology-tester.hpp"
+#include "daemon/global.hpp"
#include "face/generic-link-service.hpp"
#include <ndn-cxx/encoding/encoding-buffer-fwd.hpp>
@@ -98,7 +99,7 @@
void
TopologyLink::scheduleReceive(InternalTransportBase* recipient, const Block& packet)
{
- scheduler::schedule(m_delay, [packet, recipient] {
+ getScheduler().schedule(m_delay, [packet, recipient] {
recipient->receiveFromLink(packet);
});
}
@@ -271,8 +272,9 @@
face.expressInterest(*interest, nullptr, nullptr, nullptr);
if (n > 1) {
- scheduler::schedule(interval,
- [=, &face] { addIntervalConsumer(face, prefix, interval, n - 1, seq); });
+ getScheduler().schedule(interval, [=, &face] {
+ addIntervalConsumer(face, prefix, interval, n - 1, seq);
+ });
}
}