tools: switch to Face::getIoContext()

Change-Id: I6be4c682d62e1061af45052d2141b9e5b9e897c5
This commit is contained in:
Davide Pesavento committed 2023-11-11 17:14:02 -05:00
1 parent 9a63bf22d0
commit e277f8b9e8
10 files changed
+31 -25

No files matched your search

+5 -1
View File
@@ -128,7 +128,11 @@ class CompilerFlags:
def getGeneralFlags(self, conf): def getGeneralFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed""" """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []} return {
'CXXFLAGS': [],
'LINKFLAGS': [],
'DEFINES': ['BOOST_FILESYSTEM_NO_DEPRECATED'],
}
def getDebugFlags(self, conf): def getDebugFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode""" """Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
+2 -2
View File
@@ -59,7 +59,7 @@ The simplest way to run the tests is to launch the compiled binary without any p
# Run NFD RIB management tests # Run NFD RIB management tests
./build/unit-tests-rib ./build/unit-tests-rib
The [Boost.Test framework](https://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/index.html) The [Boost.Test framework](https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/index.html)
is very flexible and allows a number of run-time customization of what tests should be run. is very flexible and allows a number of run-time customization of what tests should be run.
For example, it is possible to choose to run only a specific test suite, only a specific For example, it is possible to choose to run only a specific test suite, only a specific
test case within a suite, or specific test cases within specific test suites: test case within a suite, or specific test cases within specific test suites:
@@ -92,4 +92,4 @@ or `-p` to show a progress bar:
There are many more command line options available, information about which can be obtained There are many more command line options available, information about which can be obtained
either from the command line using the `--help` switch, or online on the either from the command line using the `--help` switch, or online on the
[Boost.Test website](https://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/index.html). [Boost.Test website](https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/runtime_config.html).
+1 -1
View File
@@ -185,7 +185,7 @@ private:
data->setContent(resp.wireEncode()); data->setContent(resp.wireEncode());
m_keyChain.sign(*data, ndn::security::SigningInfo(ndn::security::SigningInfo::SIGNER_TYPE_SHA256)); m_keyChain.sign(*data, ndn::security::SigningInfo(ndn::security::SigningInfo::SIGNER_TYPE_SHA256));
boost::asio::post(m_face.getIoService(), [this, data] { m_face.receive(*data); }); boost::asio::post(m_face.getIoContext(), [this, data] { m_face.receive(*data); });
}; };
const Name commandPrefix("/localhost/nfd/fib/add-nexthop"); const Name commandPrefix("/localhost/nfd/fib/add-nexthop");
@@ -88,7 +88,7 @@ BOOST_AUTO_TEST_CASE(RoutablePrefixesDataset)
} }
this->initialize(options); this->initialize(options);
DummyClientFace clientFace(face.getIoService()); DummyClientFace clientFace(face.getIoContext());
clientFace.linkTo(face); clientFace.linkTo(face);
Name baseName("/localhop/nfd/rib/routable-prefixes"); Name baseName("/localhop/nfd/rib/routable-prefixes");
+7 -6
View File
@@ -108,16 +108,16 @@ private:
boost::asio::io_context& m_io; boost::asio::io_context& m_io;
}; };
/** \brief Two-stage Procedure where the first stage succeeds and the second stage fails. /**
* * Two-stage Procedure where the first stage succeeds and the second stage fails,
* But the second stage shouldn't be invoked after the first stage succeeds. * but the second stage shouldn't be invoked after the first stage succeeds.
*/ */
class ProcedureSuccessFailure : public Procedure class ProcedureSuccessFailure : public Procedure
{ {
public: public:
ProcedureSuccessFailure(Face& face, KeyChain& keyChain) ProcedureSuccessFailure(Face& face, KeyChain& keyChain)
: Procedure(face, keyChain) : Procedure(face, keyChain)
, m_io(face.getIoService()) , m_io(face.getIoContext())
{ {
} }
@@ -137,14 +137,15 @@ private:
boost::asio::io_context& m_io; boost::asio::io_context& m_io;
}; };
/** \brief Two-stage Procedure where the first stage fails and the second stage succeeds. /**
* Two-stage Procedure where the first stage fails and the second stage succeeds.
*/ */
class ProcedureFailureSuccess : public Procedure class ProcedureFailureSuccess : public Procedure
{ {
public: public:
ProcedureFailureSuccess(Face& face, KeyChain& keyChain) ProcedureFailureSuccess(Face& face, KeyChain& keyChain)
: Procedure(face, keyChain) : Procedure(face, keyChain)
, m_io(face.getIoService()) , m_io(face.getIoContext())
{ {
} }
+7 -7
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/* /*
* Copyright (c) 2014-2022, Regents of the University of California, * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents, * Arizona Board of Regents,
* Colorado State University, * Colorado State University,
* University Pierre & Marie Curie, Sorbonne University, * University Pierre & Marie Curie, Sorbonne University,
@@ -60,10 +60,10 @@ usage(std::ostream& os,
static void static void
runDaemon(Procedure& proc) runDaemon(Procedure& proc)
{ {
boost::asio::signal_set terminateSignals(proc.getIoService()); boost::asio::signal_set terminateSignals(proc.getIoContext());
terminateSignals.add(SIGINT); terminateSignals.add(SIGINT);
terminateSignals.add(SIGTERM); terminateSignals.add(SIGTERM);
terminateSignals.async_wait([&] (const boost::system::error_code& error, int signalNo) { terminateSignals.async_wait([&] (const auto& error, int signalNo) {
if (error) { if (error) {
return; return;
} }
@@ -76,10 +76,10 @@ runDaemon(Procedure& proc)
std::cerr << signalName; std::cerr << signalName;
} }
std::cerr << std::endl; std::cerr << std::endl;
proc.getIoService().stop(); proc.getIoContext().stop();
}); });
Scheduler sched(proc.getIoService()); Scheduler sched(proc.getIoContext());
scheduler::ScopedEventId runEvt; scheduler::ScopedEventId runEvt;
auto scheduleRerun = [&] (time::nanoseconds delay) { auto scheduleRerun = [&] (time::nanoseconds delay) {
runEvt = sched.schedule(delay, [&] { proc.runOnce(); }); runEvt = sched.schedule(delay, [&] { proc.runOnce(); });
@@ -89,11 +89,11 @@ runDaemon(Procedure& proc)
scheduleRerun(DAEMON_UNCONDITIONAL_INTERVAL); scheduleRerun(DAEMON_UNCONDITIONAL_INTERVAL);
}); });
net::NetworkMonitor netmon(proc.getIoService()); net::NetworkMonitor netmon(proc.getIoContext());
netmon.onNetworkStateChanged.connect([&] { scheduleRerun(NETMON_DAMPEN_PERIOD); }); netmon.onNetworkStateChanged.connect([&] { scheduleRerun(NETMON_DAMPEN_PERIOD); });
scheduleRerun(DAEMON_INITIAL_DELAY); scheduleRerun(DAEMON_INITIAL_DELAY);
proc.getIoService().run(); proc.getIoContext().run();
} }
static int static int
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/* /*
* Copyright (c) 2014-2022, Regents of the University of California, * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents, * Arizona Board of Regents,
* Colorado State University, * Colorado State University,
* University Pierre & Marie Curie, Sorbonne University, * University Pierre & Marie Curie, Sorbonne University,
@@ -108,7 +108,7 @@ Procedure::connect(const FaceUri& hubFaceUri)
std::cerr << "Failed to canonize HUB FaceUri: " << reason << std::endl; std::cerr << "Failed to canonize HUB FaceUri: " << reason << std::endl;
this->onComplete(false); this->onComplete(false);
}, },
m_face.getIoService(), FACEURI_CANONIZE_TIMEOUT); m_face.getIoContext(), FACEURI_CANONIZE_TIMEOUT);
} }
void void
+4 -3
View File
@@ -52,15 +52,16 @@ public:
void void
initialize(const Options& options); initialize(const Options& options);
/** \brief Run HUB discovery procedure once. /**
* \brief Run the HUB discovery procedure once.
*/ */
void void
runOnce(); runOnce();
boost::asio::io_context& boost::asio::io_context&
getIoService() getIoContext() const noexcept
{ {
return m_face.getIoService(); return m_face.getIoContext();
} }
private: private:
+1 -1
View File
@@ -173,7 +173,7 @@ public:
m_faceMonitor.onNotification.connect([this] (const auto& notif) { onNotification(notif); }); m_faceMonitor.onNotification.connect([this] (const auto& notif) { onNotification(notif); });
m_faceMonitor.start(); m_faceMonitor.start();
boost::asio::signal_set signalSet(m_face.getIoService(), SIGINT, SIGTERM); boost::asio::signal_set signalSet(m_face.getIoContext(), SIGINT, SIGTERM);
signalSet.async_wait([this] (auto&&...) { m_face.shutdown(); }); signalSet.async_wait([this] (auto&&...) { m_face.shutdown(); });
m_face.processEvents(); m_face.processEvents();
+1 -1
View File
@@ -186,7 +186,7 @@ canonize(ExecuteContext& ctx, const FaceUri& uri)
uri.canonize( uri.canonize(
[&result] (const auto& canonicalUri) { result = canonicalUri; }, [&result] (const auto& canonicalUri) { result = canonicalUri; },
[&error] (const auto& errorReason) { error = errorReason; }, [&error] (const auto& errorReason) { error = errorReason; },
ctx.face.getIoService(), ctx.getTimeout()); ctx.face.getIoContext(), ctx.getTimeout());
ctx.face.processEvents(); ctx.face.processEvents();
return {result, error}; return {result, error};