build: require boost >= 1.71.0
Refs: #5276 Change-Id: Ie428541639dcf1113acfb9e9d0a80f9be87d6cd3
This commit is contained in:
1 parent
910232fce0
commit
a9e1ab2664
22 files changed
+164
-181
No files matched your search
+19
-31
@@ -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-2021, 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,
|
||||||
@@ -27,18 +27,18 @@
|
|||||||
|
|
||||||
namespace nfd {
|
namespace nfd {
|
||||||
|
|
||||||
static thread_local unique_ptr<boost::asio::io_service> g_ioService;
|
static thread_local unique_ptr<boost::asio::io_context> g_ioCtx;
|
||||||
static thread_local unique_ptr<Scheduler> g_scheduler;
|
static thread_local unique_ptr<Scheduler> g_scheduler;
|
||||||
static boost::asio::io_service* g_mainIoService = nullptr;
|
static boost::asio::io_context* g_mainIoCtx = nullptr;
|
||||||
static boost::asio::io_service* g_ribIoService = nullptr;
|
static boost::asio::io_context* g_ribIoCtx = nullptr;
|
||||||
|
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
getGlobalIoService()
|
getGlobalIoService()
|
||||||
{
|
{
|
||||||
if (g_ioService == nullptr) {
|
if (g_ioCtx == nullptr) {
|
||||||
g_ioService = make_unique<boost::asio::io_service>();
|
g_ioCtx = make_unique<boost::asio::io_context>();
|
||||||
}
|
}
|
||||||
return *g_ioService;
|
return *g_ioCtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scheduler&
|
Scheduler&
|
||||||
@@ -55,46 +55,34 @@ void
|
|||||||
resetGlobalIoService()
|
resetGlobalIoService()
|
||||||
{
|
{
|
||||||
g_scheduler.reset();
|
g_scheduler.reset();
|
||||||
g_ioService.reset();
|
g_ioCtx.reset();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
getMainIoService()
|
getMainIoService()
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(g_mainIoService != nullptr);
|
BOOST_ASSERT(g_mainIoCtx != nullptr);
|
||||||
return *g_mainIoService;
|
return *g_mainIoCtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
getRibIoService()
|
getRibIoService()
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(g_ribIoService != nullptr);
|
BOOST_ASSERT(g_ribIoCtx != nullptr);
|
||||||
return *g_ribIoService;
|
return *g_ribIoCtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setMainIoService(boost::asio::io_service* mainIo)
|
setMainIoService(boost::asio::io_context* mainIo)
|
||||||
{
|
{
|
||||||
g_mainIoService = mainIo;
|
g_mainIoCtx = mainIo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setRibIoService(boost::asio::io_service* ribIo)
|
setRibIoService(boost::asio::io_context* ribIo)
|
||||||
{
|
{
|
||||||
g_ribIoService = ribIo;
|
g_ribIoCtx = ribIo;
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
runOnMainIoService(const std::function<void()>& f)
|
|
||||||
{
|
|
||||||
getMainIoService().post(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
runOnRibIoService(const std::function<void()>& f)
|
|
||||||
{
|
|
||||||
getRibIoService().post(f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nfd
|
} // namespace nfd
|
||||||
+14
-21
@@ -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,
|
||||||
@@ -27,46 +27,39 @@
|
|||||||
|
|
||||||
#include "core/common.hpp"
|
#include "core/common.hpp"
|
||||||
|
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
|
|
||||||
namespace nfd {
|
namespace nfd {
|
||||||
|
|
||||||
/** \brief Returns the global io_service instance for the calling thread.
|
/**
|
||||||
|
* \brief Returns the global io_context instance for the calling thread.
|
||||||
*/
|
*/
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
getGlobalIoService();
|
getGlobalIoService();
|
||||||
|
|
||||||
/** \brief Returns the global Scheduler instance for the calling thread.
|
/**
|
||||||
|
* \brief Returns the global Scheduler instance for the calling thread.
|
||||||
*/
|
*/
|
||||||
Scheduler&
|
Scheduler&
|
||||||
getScheduler();
|
getScheduler();
|
||||||
|
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
getMainIoService();
|
getMainIoService();
|
||||||
|
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
getRibIoService();
|
getRibIoService();
|
||||||
|
|
||||||
void
|
void
|
||||||
setMainIoService(boost::asio::io_service* mainIo);
|
setMainIoService(boost::asio::io_context* mainIo);
|
||||||
|
|
||||||
void
|
void
|
||||||
setRibIoService(boost::asio::io_service* ribIo);
|
setRibIoService(boost::asio::io_context* ribIo);
|
||||||
|
|
||||||
/** \brief Run a function on the main io_service instance.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
runOnMainIoService(const std::function<void()>& f);
|
|
||||||
|
|
||||||
/** \brief Run a function on the RIB io_service instance.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
runOnRibIoService(const std::function<void()>& f);
|
|
||||||
|
|
||||||
#ifdef NFD_WITH_TESTS
|
#ifdef NFD_WITH_TESTS
|
||||||
/** \brief Destroy the global io_service instance.
|
/**
|
||||||
|
* \brief Destroy the global io_context instance.
|
||||||
*
|
*
|
||||||
* It will be recreated at the next invocation of getGlobalIoService().
|
* It will be recreated at the next invocation of getGlobalIoService().
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
resetGlobalIoService();
|
resetGlobalIoService();
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -128,13 +128,7 @@ TcpTransport::reconnect()
|
|||||||
BOOST_ASSERT(getState() == TransportState::DOWN);
|
BOOST_ASSERT(getState() == TransportState::DOWN);
|
||||||
|
|
||||||
// recreate the socket
|
// recreate the socket
|
||||||
m_socket = protocol::socket(
|
m_socket = protocol::socket(m_socket.get_executor());
|
||||||
#if BOOST_VERSION >= 107000
|
|
||||||
m_socket.get_executor()
|
|
||||||
#else
|
|
||||||
m_socket.get_io_service()
|
|
||||||
#endif // BOOST_VERSION >= 107000
|
|
||||||
);
|
|
||||||
this->resetReceiveBuffer();
|
this->resetReceiveBuffer();
|
||||||
this->resetSendQueue();
|
this->resetSendQueue();
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <ndn-cxx/lp/prefix-announcement-header.hpp>
|
#include <ndn-cxx/lp/prefix-announcement-header.hpp>
|
||||||
#include <ndn-cxx/lp/tags.hpp>
|
#include <ndn-cxx/lp/tags.hpp>
|
||||||
|
|
||||||
|
#include <boost/asio/post.hpp>
|
||||||
#include <boost/range/adaptor/reversed.hpp>
|
#include <boost/range/adaptor/reversed.hpp>
|
||||||
|
|
||||||
namespace nfd::fw {
|
namespace nfd::fw {
|
||||||
@@ -188,26 +189,28 @@ SelfLearningStrategy::asyncProcessData(const shared_ptr<pit::Entry>& pitEntry, c
|
|||||||
// (the PIT entry's expiry timer was set to 0 before dispatching)
|
// (the PIT entry's expiry timer was set to 0 before dispatching)
|
||||||
this->setExpiryTimer(pitEntry, 1_s);
|
this->setExpiryTimer(pitEntry, 1_s);
|
||||||
|
|
||||||
runOnRibIoService([this, pitEntryWeak = weak_ptr<pit::Entry>{pitEntry}, inFaceId = inFace.getId(), data] {
|
boost::asio::post(getRibIoService(),
|
||||||
rib::Service::get().getRibManager().slFindAnn(data.getName(),
|
[this, pitEntryWeak = weak_ptr<pit::Entry>{pitEntry}, inFaceId = inFace.getId(), data] {
|
||||||
[this, pitEntryWeak, inFaceId, data] (std::optional<ndn::PrefixAnnouncement> paOpt) {
|
rib::Service::get().getRibManager().slFindAnn(data.getName(),
|
||||||
if (paOpt) {
|
[this, pitEntryWeak, inFaceId, data] (std::optional<ndn::PrefixAnnouncement> paOpt) {
|
||||||
runOnMainIoService([this, pitEntryWeak, inFaceId, data, pa = std::move(*paOpt)] {
|
if (paOpt) {
|
||||||
auto pitEntry = pitEntryWeak.lock();
|
boost::asio::post(getMainIoService(),
|
||||||
auto inFace = this->getFace(inFaceId);
|
[this, pitEntryWeak, inFaceId, data, pa = std::move(*paOpt)] {
|
||||||
if (pitEntry && inFace) {
|
auto pitEntry = pitEntryWeak.lock();
|
||||||
NFD_LOG_DEBUG("Found PrefixAnnouncement=" << pa.getAnnouncedName());
|
auto inFace = this->getFace(inFaceId);
|
||||||
data.setTag(make_shared<lp::PrefixAnnouncementTag>(lp::PrefixAnnouncementHeader(pa)));
|
if (pitEntry && inFace) {
|
||||||
this->sendDataToAll(data, pitEntry, *inFace);
|
NFD_LOG_DEBUG("Found PrefixAnnouncement=" << pa.getAnnouncedName());
|
||||||
this->setExpiryTimer(pitEntry, 0_ms);
|
data.setTag(make_shared<lp::PrefixAnnouncementTag>(lp::PrefixAnnouncementHeader(pa)));
|
||||||
}
|
this->sendDataToAll(data, pitEntry, *inFace);
|
||||||
else {
|
this->setExpiryTimer(pitEntry, 0_ms);
|
||||||
NFD_LOG_DEBUG("PIT entry or face no longer exists");
|
}
|
||||||
}
|
else {
|
||||||
});
|
NFD_LOG_DEBUG("PIT entry or face no longer exists");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -235,24 +238,26 @@ void
|
|||||||
SelfLearningStrategy::addRoute(const shared_ptr<pit::Entry>& pitEntry, const Face& inFace,
|
SelfLearningStrategy::addRoute(const shared_ptr<pit::Entry>& pitEntry, const Face& inFace,
|
||||||
const Data& data, const ndn::PrefixAnnouncement& pa)
|
const Data& data, const ndn::PrefixAnnouncement& pa)
|
||||||
{
|
{
|
||||||
runOnRibIoService([pitEntryWeak = weak_ptr<pit::Entry>{pitEntry}, inFaceId = inFace.getId(), data, pa] {
|
boost::asio::post(getRibIoService(),
|
||||||
rib::Service::get().getRibManager().slAnnounce(pa, inFaceId, ROUTE_RENEW_LIFETIME,
|
[pitEntryWeak = weak_ptr<pit::Entry>{pitEntry}, inFaceId = inFace.getId(), data, pa] {
|
||||||
[] (RibManager::SlAnnounceResult res) {
|
rib::Service::get().getRibManager().slAnnounce(pa, inFaceId, ROUTE_RENEW_LIFETIME,
|
||||||
NFD_LOG_DEBUG("Add route via PrefixAnnouncement with result=" << res);
|
[] (RibManager::SlAnnounceResult res) {
|
||||||
});
|
NFD_LOG_DEBUG("Add route via PrefixAnnouncement with result=" << res);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SelfLearningStrategy::renewRoute(const Name& name, FaceId inFaceId, time::milliseconds maxLifetime)
|
SelfLearningStrategy::renewRoute(const Name& name, FaceId inFaceId, time::milliseconds maxLifetime)
|
||||||
{
|
{
|
||||||
// renew route with PA or ignore PA (if route has no PA)
|
// renew route with PA or ignore PA (if route has no PA)
|
||||||
runOnRibIoService([name, inFaceId, maxLifetime] {
|
boost::asio::post(getRibIoService(),
|
||||||
rib::Service::get().getRibManager().slRenew(name, inFaceId, maxLifetime,
|
[name, inFaceId, maxLifetime] {
|
||||||
[] (RibManager::SlAnnounceResult res) {
|
rib::Service::get().getRibManager().slRenew(name, inFaceId, maxLifetime,
|
||||||
NFD_LOG_DEBUG("Renew route with result=" << res);
|
[] (RibManager::SlAnnounceResult res) {
|
||||||
});
|
NFD_LOG_DEBUG("Renew route with result=" << res);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace nfd::fw
|
} // namespace nfd::fw
|
||||||
+4
-4
@@ -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,
|
||||||
@@ -70,7 +70,7 @@ namespace nfd {
|
|||||||
/** \brief Executes NFD with RIB manager
|
/** \brief Executes NFD with RIB manager
|
||||||
*
|
*
|
||||||
* NFD (main forwarding procedure) and RIB manager execute in two different threads.
|
* NFD (main forwarding procedure) and RIB manager execute in two different threads.
|
||||||
* Each thread has its own instances of global io_service and global scheduler.
|
* Each thread has its own instances of global io_context and global scheduler.
|
||||||
*
|
*
|
||||||
* When either of the daemons fails, execution of non-failed daemon will be terminated as
|
* When either of the daemons fails, execution of non-failed daemon will be terminated as
|
||||||
* well. In other words, when NFD fails, RIB manager will be terminated; when RIB manager
|
* well. In other words, when NFD fails, RIB manager will be terminated; when RIB manager
|
||||||
@@ -107,9 +107,9 @@ public:
|
|||||||
// a separate thread) fails.
|
// a separate thread) fails.
|
||||||
std::atomic_int retval(0);
|
std::atomic_int retval(0);
|
||||||
|
|
||||||
boost::asio::io_service* const mainIo = &getGlobalIoService();
|
boost::asio::io_context* const mainIo = &getGlobalIoService();
|
||||||
setMainIoService(mainIo);
|
setMainIoService(mainIo);
|
||||||
boost::asio::io_service* ribIo = nullptr;
|
boost::asio::io_context* ribIo = nullptr;
|
||||||
|
|
||||||
// Mutex and conditional variable to implement synchronization between main and RIB manager
|
// Mutex and conditional variable to implement synchronization between main and RIB manager
|
||||||
// threads:
|
// threads:
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -46,7 +46,7 @@ class Readvertise;
|
|||||||
* \brief Initializes and executes the NFD-RIB service thread.
|
* \brief Initializes and executes the NFD-RIB service thread.
|
||||||
*
|
*
|
||||||
* Only one instance of this class can be created at any time.
|
* Only one instance of this class can be created at any time.
|
||||||
* After initialization, NFD-RIB instance can be started by running the global io_service.
|
* After initialization, NFD-RIB instance can be started by running the global io_context.
|
||||||
*/
|
*/
|
||||||
class Service : noncopyable
|
class Service : noncopyable
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -29,6 +29,8 @@
|
|||||||
#include "tests/daemon/global-io-fixture.hpp"
|
#include "tests/daemon/global-io-fixture.hpp"
|
||||||
#include "tests/daemon/rib-io-fixture.hpp"
|
#include "tests/daemon/rib-io-fixture.hpp"
|
||||||
|
|
||||||
|
#include <boost/asio/post.hpp>
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
namespace nfd::tests {
|
namespace nfd::tests {
|
||||||
@@ -37,8 +39,8 @@ BOOST_FIXTURE_TEST_SUITE(TestGlobal, GlobalIoFixture)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(ThreadLocalIoService)
|
BOOST_AUTO_TEST_CASE(ThreadLocalIoService)
|
||||||
{
|
{
|
||||||
boost::asio::io_service* s1 = &getGlobalIoService();
|
boost::asio::io_context* s1 = &getGlobalIoService();
|
||||||
boost::asio::io_service* s2 = nullptr;
|
boost::asio::io_context* s2 = nullptr;
|
||||||
|
|
||||||
std::thread t([&s2] { s2 = &getGlobalIoService(); });
|
std::thread t([&s2] { s2 = &getGlobalIoService(); });
|
||||||
t.join();
|
t.join();
|
||||||
@@ -63,8 +65,8 @@ BOOST_AUTO_TEST_CASE(ThreadLocalScheduler)
|
|||||||
|
|
||||||
BOOST_FIXTURE_TEST_CASE(MainRibIoService, RibIoFixture)
|
BOOST_FIXTURE_TEST_CASE(MainRibIoService, RibIoFixture)
|
||||||
{
|
{
|
||||||
boost::asio::io_service* mainIo = &g_io;
|
boost::asio::io_context* mainIo = &g_io;
|
||||||
boost::asio::io_service* ribIo = g_ribIo;
|
boost::asio::io_context* ribIo = g_ribIo;
|
||||||
|
|
||||||
BOOST_CHECK(mainIo != ribIo);
|
BOOST_CHECK(mainIo != ribIo);
|
||||||
BOOST_CHECK(&getGlobalIoService() == mainIo);
|
BOOST_CHECK(&getGlobalIoService() == mainIo);
|
||||||
@@ -72,15 +74,15 @@ BOOST_FIXTURE_TEST_CASE(MainRibIoService, RibIoFixture)
|
|||||||
BOOST_CHECK(&getRibIoService() == ribIo);
|
BOOST_CHECK(&getRibIoService() == ribIo);
|
||||||
auto mainThreadId = std::this_thread::get_id();
|
auto mainThreadId = std::this_thread::get_id();
|
||||||
|
|
||||||
runOnRibIoService([&] {
|
boost::asio::post(getRibIoService(), [&] {
|
||||||
BOOST_CHECK(mainThreadId != std::this_thread::get_id());
|
BOOST_CHECK(mainThreadId != std::this_thread::get_id());
|
||||||
BOOST_CHECK(&getGlobalIoService() == ribIo);
|
BOOST_CHECK(&getGlobalIoService() == ribIo);
|
||||||
BOOST_CHECK(&getMainIoService() == mainIo);
|
BOOST_CHECK(&getMainIoService() == mainIo);
|
||||||
BOOST_CHECK(&getRibIoService() == ribIo);
|
BOOST_CHECK(&getRibIoService() == ribIo);
|
||||||
});
|
});
|
||||||
|
|
||||||
runOnRibIoService([&] {
|
boost::asio::post(getRibIoService(), [&] {
|
||||||
runOnMainIoService([&] {
|
boost::asio::post(getMainIoService(), [&] {
|
||||||
BOOST_CHECK(mainThreadId == std::this_thread::get_id());
|
BOOST_CHECK(mainThreadId == std::this_thread::get_id());
|
||||||
BOOST_CHECK(&getGlobalIoService() == mainIo);
|
BOOST_CHECK(&getGlobalIoService() == mainIo);
|
||||||
BOOST_CHECK(&getMainIoService() == mainIo);
|
BOOST_CHECK(&getMainIoService() == mainIo);
|
||||||
@@ -92,7 +94,7 @@ BOOST_FIXTURE_TEST_CASE(MainRibIoService, RibIoFixture)
|
|||||||
BOOST_FIXTURE_TEST_CASE(PollInAllThreads, RibIoFixture)
|
BOOST_FIXTURE_TEST_CASE(PollInAllThreads, RibIoFixture)
|
||||||
{
|
{
|
||||||
bool hasRibRun = false;
|
bool hasRibRun = false;
|
||||||
runOnRibIoService([&] { hasRibRun = true; });
|
boost::asio::post(getRibIoService(), [&] { hasRibRun = true; });
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
BOOST_CHECK_EQUAL(hasRibRun, false);
|
BOOST_CHECK_EQUAL(hasRibRun, false);
|
||||||
|
|
||||||
@@ -101,9 +103,9 @@ BOOST_FIXTURE_TEST_CASE(PollInAllThreads, RibIoFixture)
|
|||||||
|
|
||||||
hasRibRun = false;
|
hasRibRun = false;
|
||||||
bool hasMainRun = false;
|
bool hasMainRun = false;
|
||||||
runOnMainIoService([&] {
|
boost::asio::post(getMainIoService(), [&] {
|
||||||
hasMainRun = true;
|
hasMainRun = true;
|
||||||
runOnRibIoService([&] { hasRibRun = true; });
|
boost::asio::post(getRibIoService(), [&] { hasRibRun = true; });
|
||||||
});
|
});
|
||||||
BOOST_CHECK_EQUAL(hasMainRun, false);
|
BOOST_CHECK_EQUAL(hasMainRun, false);
|
||||||
BOOST_CHECK_EQUAL(hasRibRun, false);
|
BOOST_CHECK_EQUAL(hasRibRun, false);
|
||||||
@@ -116,7 +118,7 @@ BOOST_FIXTURE_TEST_CASE(PollInAllThreads, RibIoFixture)
|
|||||||
BOOST_FIXTURE_TEST_CASE(AdvanceClocks, RibIoTimeFixture)
|
BOOST_FIXTURE_TEST_CASE(AdvanceClocks, RibIoTimeFixture)
|
||||||
{
|
{
|
||||||
bool hasRibRun = false;
|
bool hasRibRun = false;
|
||||||
runOnRibIoService([&] { hasRibRun = true; });
|
boost::asio::post(getRibIoService(), [&] { hasRibRun = true; });
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
BOOST_CHECK_EQUAL(hasRibRun, false);
|
BOOST_CHECK_EQUAL(hasRibRun, false);
|
||||||
|
|
||||||
@@ -127,7 +129,7 @@ BOOST_FIXTURE_TEST_CASE(AdvanceClocks, RibIoTimeFixture)
|
|||||||
bool hasMainRun = false;
|
bool hasMainRun = false;
|
||||||
getScheduler().schedule(250_ms, [&] {
|
getScheduler().schedule(250_ms, [&] {
|
||||||
hasMainRun = true;
|
hasMainRun = true;
|
||||||
runOnRibIoService([&] { hasRibRun = true; });
|
boost::asio::post(getRibIoService(), [&] { hasRibRun = true; });
|
||||||
});
|
});
|
||||||
BOOST_CHECK_EQUAL(hasMainRun, false);
|
BOOST_CHECK_EQUAL(hasMainRun, false);
|
||||||
BOOST_CHECK_EQUAL(hasRibRun, false);
|
BOOST_CHECK_EQUAL(hasRibRun, false);
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
namespace nfd::tests {
|
namespace nfd::tests {
|
||||||
|
|
||||||
/** \brief Enumerate network interfaces using the given NetworkMonitor
|
/** \brief Enumerate network interfaces using the given NetworkMonitor
|
||||||
* \param netmon a NetworkMonitor constructed on the global io_service.
|
* \param netmon a NetworkMonitor constructed on the global io_context.
|
||||||
* \note This function is blocking
|
* \note This function is blocking
|
||||||
* \note Signals are supported if caller keeps \p netmon running
|
* \note Signals are supported if caller keeps \p netmon running
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -48,7 +48,7 @@ class AcceptorWithCleanup : public unix_stream::acceptor
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit
|
explicit
|
||||||
AcceptorWithCleanup(boost::asio::io_service& io, const std::string& path = "")
|
AcceptorWithCleanup(boost::asio::io_context& io, const std::string& path = "")
|
||||||
: unix_stream::acceptor(io)
|
: unix_stream::acceptor(io)
|
||||||
{
|
{
|
||||||
this->open();
|
this->open();
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -42,11 +42,7 @@ size_t
|
|||||||
GlobalIoFixture::pollIo()
|
GlobalIoFixture::pollIo()
|
||||||
{
|
{
|
||||||
if (g_io.stopped()) {
|
if (g_io.stopped()) {
|
||||||
#if BOOST_VERSION >= 106600
|
|
||||||
g_io.restart();
|
g_io.restart();
|
||||||
#else
|
|
||||||
g_io.reset();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return g_io.poll();
|
return g_io.poll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -30,10 +30,11 @@
|
|||||||
|
|
||||||
namespace nfd::tests {
|
namespace nfd::tests {
|
||||||
|
|
||||||
/** \brief A fixture providing proper setup and teardown of the global io_service.
|
/**
|
||||||
|
* \brief A fixture providing proper setup and teardown of the global io_context.
|
||||||
*
|
*
|
||||||
* Every daemon fixture or test case should inherit from this fixture,
|
* Every daemon fixture or test case should inherit from this fixture,
|
||||||
* to have per test case io_service initialization and cleanup.
|
* to have per test case io_context initialization and cleanup.
|
||||||
*/
|
*/
|
||||||
class GlobalIoFixture
|
class GlobalIoFixture
|
||||||
{
|
{
|
||||||
@@ -42,18 +43,21 @@ protected:
|
|||||||
|
|
||||||
~GlobalIoFixture();
|
~GlobalIoFixture();
|
||||||
|
|
||||||
/** \brief Poll the global io_service.
|
/**
|
||||||
|
* \brief Poll the global io_context.
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
pollIo();
|
pollIo();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** \brief Reference to the global io_service instance.
|
/**
|
||||||
|
* \brief Reference to the global io_context instance.
|
||||||
*/
|
*/
|
||||||
boost::asio::io_service& g_io;
|
boost::asio::io_context& g_io;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief GlobalIoFixture that also overrides steady clock and system clock.
|
/**
|
||||||
|
* \brief GlobalIoFixture that also overrides steady clock and system clock.
|
||||||
*/
|
*/
|
||||||
class GlobalIoTimeFixture : public ClockFixture, public GlobalIoFixture
|
class GlobalIoTimeFixture : public ClockFixture, public GlobalIoFixture
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -34,7 +34,8 @@
|
|||||||
|
|
||||||
namespace nfd::tests {
|
namespace nfd::tests {
|
||||||
|
|
||||||
/** \brief A base test fixture that provides both main and RIB io_service.
|
/**
|
||||||
|
* \brief A base test fixture that provides both main and RIB io_context.
|
||||||
*/
|
*/
|
||||||
class RibIoFixture : public GlobalIoFixture
|
class RibIoFixture : public GlobalIoFixture
|
||||||
{
|
{
|
||||||
@@ -44,27 +45,31 @@ protected:
|
|||||||
~RibIoFixture();
|
~RibIoFixture();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** \brief Poll main and RIB thread io_service to process all pending I/O events.
|
/**
|
||||||
|
* \brief Poll main and RIB thread io_context to process all pending I/O events.
|
||||||
*
|
*
|
||||||
* This call will execute all pending I/O events, including events that are posted
|
* This call will execute all pending I/O events, including events that are posted
|
||||||
* inside the processing event, i.e., main and RIB thread io_service will be polled
|
* inside the processing event, i.e., main and RIB thread io_context will be polled
|
||||||
* repeatedly until all pending events are processed.
|
* repeatedly until all pending events are processed.
|
||||||
*
|
*
|
||||||
* \warning Must be called from the main thread
|
* \warning Must be called from the main thread.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
poll();
|
poll();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** \brief Pointer to global main io_service.
|
/**
|
||||||
|
* \brief Pointer to global main io_context.
|
||||||
*/
|
*/
|
||||||
boost::asio::io_service* g_mainIo = nullptr;
|
boost::asio::io_context* g_mainIo = nullptr;
|
||||||
|
|
||||||
/** \brief Pointer to global RIB io_service.
|
/**
|
||||||
|
* \brief Pointer to global RIB io_context.
|
||||||
*/
|
*/
|
||||||
boost::asio::io_service* g_ribIo = nullptr;
|
boost::asio::io_context* g_ribIo = nullptr;
|
||||||
|
|
||||||
/** \brief Global RIB thread.
|
/**
|
||||||
|
* \brief Global RIB thread.
|
||||||
*/
|
*/
|
||||||
std::thread g_ribThread;
|
std::thread g_ribThread;
|
||||||
|
|
||||||
@@ -76,7 +81,8 @@ private:
|
|||||||
std::condition_variable m_ribPollEndCv;
|
std::condition_variable m_ribPollEndCv;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief RibIoFixture that also overrides steady clock and system clock.
|
/**
|
||||||
|
* \brief RibIoFixture that also overrides steady clock and system clock.
|
||||||
*/
|
*/
|
||||||
class RibIoTimeFixture : public ClockFixture, public RibIoFixture
|
class RibIoTimeFixture : public ClockFixture, public RibIoFixture
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -29,7 +29,9 @@
|
|||||||
#include "tests/test-common.hpp"
|
#include "tests/test-common.hpp"
|
||||||
#include "tests/daemon/rib-io-fixture.hpp"
|
#include "tests/daemon/rib-io-fixture.hpp"
|
||||||
|
|
||||||
|
#include <boost/asio/post.hpp>
|
||||||
#include <boost/property_tree/info_parser.hpp>
|
#include <boost/property_tree/info_parser.hpp>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace nfd::tests {
|
namespace nfd::tests {
|
||||||
@@ -63,7 +65,7 @@ BOOST_AUTO_TEST_CASE(Basic)
|
|||||||
BOOST_CHECK_THROW(Service::get(), std::logic_error);
|
BOOST_CHECK_THROW(Service::get(), std::logic_error);
|
||||||
BOOST_CHECK_THROW(Service(section, m_ribKeyChain), std::logic_error);
|
BOOST_CHECK_THROW(Service(section, m_ribKeyChain), std::logic_error);
|
||||||
|
|
||||||
runOnRibIoService([&] {
|
boost::asio::post(getRibIoService(), [&] {
|
||||||
{
|
{
|
||||||
BOOST_CHECK_THROW(Service::get(), std::logic_error);
|
BOOST_CHECK_THROW(Service::get(), std::logic_error);
|
||||||
Service ribService(section, m_ribKeyChain);
|
Service ribService(section, m_ribKeyChain);
|
||||||
@@ -87,7 +89,7 @@ BOOST_AUTO_TEST_CASE(EmptyLocalhostSecurity)
|
|||||||
}
|
}
|
||||||
)CONFIG";
|
)CONFIG";
|
||||||
|
|
||||||
runOnRibIoService([&] {
|
boost::asio::post(getRibIoService(), [&] {
|
||||||
BOOST_CHECK_NO_THROW(Service(makeSection(CONFIG), m_ribKeyChain));
|
BOOST_CHECK_NO_THROW(Service(makeSection(CONFIG), m_ribKeyChain));
|
||||||
});
|
});
|
||||||
poll();
|
poll();
|
||||||
@@ -102,7 +104,7 @@ BOOST_AUTO_TEST_CASE(EmptyPrefixAnnouncementValidation)
|
|||||||
}
|
}
|
||||||
)CONFIG";
|
)CONFIG";
|
||||||
|
|
||||||
runOnRibIoService([&] {
|
boost::asio::post(getRibIoService(), [&] {
|
||||||
BOOST_CHECK_NO_THROW(Service(makeSection(CONFIG), m_ribKeyChain));
|
BOOST_CHECK_NO_THROW(Service(makeSection(CONFIG), m_ribKeyChain));
|
||||||
});
|
});
|
||||||
poll();
|
poll();
|
||||||
@@ -131,7 +133,7 @@ BOOST_AUTO_TEST_CASE(LocalhopAndPropagate)
|
|||||||
}
|
}
|
||||||
)CONFIG";
|
)CONFIG";
|
||||||
|
|
||||||
runOnRibIoService([&] {
|
boost::asio::post(getRibIoService(), [&] {
|
||||||
BOOST_CHECK_EXCEPTION(Service(makeSection(CONFIG), m_ribKeyChain), ConfigFile::Error,
|
BOOST_CHECK_EXCEPTION(Service(makeSection(CONFIG), m_ribKeyChain), ConfigFile::Error,
|
||||||
[] (const auto& e) {
|
[] (const auto& e) {
|
||||||
return e.what() == "localhop_security and auto_prefix_propagate "
|
return e.what() == "localhop_security and auto_prefix_propagate "
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "tests/clock-fixture.hpp"
|
#include "tests/clock-fixture.hpp"
|
||||||
|
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_context.hpp>
|
||||||
|
|
||||||
namespace nfd::tests {
|
namespace nfd::tests {
|
||||||
|
|
||||||
@@ -39,17 +39,13 @@ private:
|
|||||||
afterTick() final
|
afterTick() final
|
||||||
{
|
{
|
||||||
if (m_io.stopped()) {
|
if (m_io.stopped()) {
|
||||||
#if BOOST_VERSION >= 106600
|
|
||||||
m_io.restart();
|
m_io.restart();
|
||||||
#else
|
|
||||||
m_io.reset();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
m_io.poll();
|
m_io.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
boost::asio::io_service m_io;
|
boost::asio::io_context m_io;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nfd::tests
|
} // namespace nfd::tests
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ def build(bld):
|
|||||||
# main
|
# main
|
||||||
bld.objects(target=f'other-tests-{module}-main',
|
bld.objects(target=f'other-tests-{module}-main',
|
||||||
source='../main.cpp',
|
source='../main.cpp',
|
||||||
use='BOOST',
|
use='BOOST_TESTS',
|
||||||
defines=[f'BOOST_TEST_MODULE={name}'])
|
defines=[f'BOOST_TEST_MODULE={name}'])
|
||||||
# module
|
# module
|
||||||
bld.program(name=module,
|
bld.program(name=module,
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -66,10 +66,10 @@ public:
|
|||||||
/** \param stageName stage name
|
/** \param stageName stage name
|
||||||
* \param nCalls pointer to a variable which is incremented each time doStart is invoked
|
* \param nCalls pointer to a variable which is incremented each time doStart is invoked
|
||||||
* \param result expected result, nullopt to cause a failued
|
* \param result expected result, nullopt to cause a failued
|
||||||
* \param io io_service to asynchronously post the result
|
* \param io io_context to asynchronously post the result
|
||||||
*/
|
*/
|
||||||
DummyStage(const std::string& stageName, int* nCalls,
|
DummyStage(const std::string& stageName, int* nCalls,
|
||||||
const std::optional<FaceUri>& result, boost::asio::io_service& io)
|
const std::optional<FaceUri>& result, boost::asio::io_context& io)
|
||||||
: m_stageName(stageName)
|
: m_stageName(stageName)
|
||||||
, m_nCalls(nCalls)
|
, m_nCalls(nCalls)
|
||||||
, m_result(result)
|
, m_result(result)
|
||||||
@@ -90,7 +90,8 @@ private:
|
|||||||
if (m_nCalls != nullptr) {
|
if (m_nCalls != nullptr) {
|
||||||
++(*m_nCalls);
|
++(*m_nCalls);
|
||||||
}
|
}
|
||||||
m_io.post([this] {
|
|
||||||
|
boost::asio::post(m_io, [this] {
|
||||||
if (m_result) {
|
if (m_result) {
|
||||||
this->succeed(*m_result);
|
this->succeed(*m_result);
|
||||||
}
|
}
|
||||||
@@ -104,7 +105,7 @@ private:
|
|||||||
std::string m_stageName;
|
std::string m_stageName;
|
||||||
int* m_nCalls;
|
int* m_nCalls;
|
||||||
std::optional<FaceUri> m_result;
|
std::optional<FaceUri> m_result;
|
||||||
boost::asio::io_service& m_io;
|
boost::asio::io_context& m_io;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Two-stage Procedure where the first stage succeeds and the second stage fails.
|
/** \brief Two-stage Procedure where the first stage succeeds and the second stage fails.
|
||||||
@@ -133,7 +134,7 @@ public:
|
|||||||
int nCalls2 = 0;
|
int nCalls2 = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::asio::io_service& m_io;
|
boost::asio::io_context& m_io;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief Two-stage Procedure where the first stage fails and the second stage succeeds.
|
/** \brief Two-stage Procedure where the first stage fails and the second stage succeeds.
|
||||||
@@ -160,7 +161,7 @@ public:
|
|||||||
int nCalls2 = 0;
|
int nCalls2 = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::asio::io_service& m_io;
|
boost::asio::io_context& m_io;
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE(NdnAutoconfig)
|
BOOST_AUTO_TEST_SUITE(NdnAutoconfig)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ module2
|
|||||||
class DummyModule : public Module
|
class DummyModule : public Module
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DummyModule(const std::string& moduleName, boost::asio::io_service& io)
|
DummyModule(const std::string& moduleName, boost::asio::io_context& io)
|
||||||
: m_moduleName(moduleName)
|
: m_moduleName(moduleName)
|
||||||
, m_scheduler(io)
|
, m_scheduler(io)
|
||||||
, m_res(0)
|
, m_res(0)
|
||||||
|
|||||||
+2
-2
@@ -35,7 +35,7 @@ def build(bld):
|
|||||||
target='tests-common',
|
target='tests-common',
|
||||||
features='pch',
|
features='pch',
|
||||||
source=bld.path.ant_glob('*.cpp', excl='main.cpp'),
|
source=bld.path.ant_glob('*.cpp', excl='main.cpp'),
|
||||||
use='core-objects',
|
use='BOOST_TESTS core-objects',
|
||||||
headers='../core/common.hpp boost-test.hpp',
|
headers='../core/common.hpp boost-test.hpp',
|
||||||
defines=[tmpdir])
|
defines=[tmpdir])
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ def build(bld):
|
|||||||
# main() for the module
|
# main() for the module
|
||||||
bld.objects(target=f'unit-tests-{module}-main',
|
bld.objects(target=f'unit-tests-{module}-main',
|
||||||
source='main.cpp',
|
source='main.cpp',
|
||||||
use='BOOST',
|
use='BOOST_TESTS',
|
||||||
defines=[f'BOOST_TEST_MODULE=NFD {module.capitalize()}'])
|
defines=[f'BOOST_TEST_MODULE=NFD {module.capitalize()}'])
|
||||||
|
|
||||||
subdir = 'daemon/rib' if module == 'rib' else module
|
subdir = 'daemon/rib' if module == 'rib' else module
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -140,11 +140,7 @@ NdnFchDiscovery::doStart()
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
boost::asio::ip::tcp::iostream requestStream;
|
boost::asio::ip::tcp::iostream requestStream;
|
||||||
#if BOOST_VERSION >= 106700
|
|
||||||
requestStream.expires_after(std::chrono::seconds(3));
|
requestStream.expires_after(std::chrono::seconds(3));
|
||||||
#else
|
|
||||||
requestStream.expires_from_now(boost::posix_time::seconds(3));
|
|
||||||
#endif // BOOST_VERSION >= 106700
|
|
||||||
|
|
||||||
Url url(m_url);
|
Url url(m_url);
|
||||||
if (!url.isValid()) {
|
if (!url.isValid()) {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
void
|
void
|
||||||
runOnce();
|
runOnce();
|
||||||
|
|
||||||
boost::asio::io_service&
|
boost::asio::io_context&
|
||||||
getIoService()
|
getIoService()
|
||||||
{
|
{
|
||||||
return m_face.getIoService();
|
return m_face.getIoService();
|
||||||
|
|||||||
+2
-2
@@ -63,7 +63,7 @@ def build(bld):
|
|||||||
bld.objects(target=srcObjects,
|
bld.objects(target=srcObjects,
|
||||||
source=srcFiles,
|
source=srcFiles,
|
||||||
features='pch',
|
features='pch',
|
||||||
headers=subdir.find_node(name + '-pch.hpp'),
|
headers=subdir.find_node(f'{name}-pch.hpp'),
|
||||||
use='core-objects LIBRESOLV',
|
use='core-objects LIBRESOLV',
|
||||||
includes=name)
|
includes=name)
|
||||||
testableObjects.append(srcObjects)
|
testableObjects.append(srcObjects)
|
||||||
@@ -71,7 +71,7 @@ def build(bld):
|
|||||||
bld.program(name=name,
|
bld.program(name=name,
|
||||||
target=f'{top}/bin/{name}',
|
target=f'{top}/bin/{name}',
|
||||||
source=[mainFile],
|
source=[mainFile],
|
||||||
use='core-objects ' + srcObjects,
|
use=f'core-objects {srcObjects}',
|
||||||
includes=name)
|
includes=name)
|
||||||
|
|
||||||
bld.objects(target='tools-objects',
|
bld.objects(target='tools-objects',
|
||||||
|
|||||||
@@ -23,8 +23,9 @@ You should have received a copy of the GNU General Public License along with
|
|||||||
NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
|
NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
from waflib import Context, Logs, Utils
|
from waflib import Context, Logs, Utils
|
||||||
import os, subprocess
|
|
||||||
|
|
||||||
VERSION = '22.12'
|
VERSION = '22.12'
|
||||||
APPNAME = 'nfd'
|
APPNAME = 'nfd'
|
||||||
@@ -113,16 +114,15 @@ def configure(conf):
|
|||||||
|
|
||||||
conf.check_cxx(header_name='valgrind/valgrind.h', define_name='HAVE_VALGRIND', mandatory=False)
|
conf.check_cxx(header_name='valgrind/valgrind.h', define_name='HAVE_VALGRIND', mandatory=False)
|
||||||
|
|
||||||
boost_libs = ['system', 'program_options', 'filesystem']
|
conf.check_boost(lib='filesystem program_options', mt=True)
|
||||||
if conf.env.WITH_TESTS or conf.env.WITH_OTHER_TESTS:
|
if conf.env.BOOST_VERSION_NUMBER < 107100:
|
||||||
boost_libs.append('unit_test_framework')
|
conf.fatal('The minimum supported version of Boost is 1.71.0.\n'
|
||||||
|
|
||||||
conf.check_boost(lib=boost_libs, mt=True)
|
|
||||||
if conf.env.BOOST_VERSION_NUMBER < 106501:
|
|
||||||
conf.fatal('The minimum supported version of Boost is 1.65.1.\n'
|
|
||||||
'Please upgrade your distribution or manually install a newer version of Boost.\n'
|
'Please upgrade your distribution or manually install a newer version of Boost.\n'
|
||||||
'For more information, see https://redmine.named-data.net/projects/nfd/wiki/Boost')
|
'For more information, see https://redmine.named-data.net/projects/nfd/wiki/Boost')
|
||||||
|
|
||||||
|
if conf.env.WITH_TESTS or conf.env.WITH_OTHER_TESTS:
|
||||||
|
conf.check_boost(lib='unit_test_framework', mt=True, uselib_store='BOOST_TESTS')
|
||||||
|
|
||||||
conf.load('unix-socket')
|
conf.load('unix-socket')
|
||||||
|
|
||||||
if not conf.options.without_libpcap:
|
if not conf.options.without_libpcap:
|
||||||
@@ -160,8 +160,8 @@ def build(bld):
|
|||||||
|
|
||||||
bld.objects(
|
bld.objects(
|
||||||
target='core-objects',
|
target='core-objects',
|
||||||
source=bld.path.find_node('core').ant_glob('*.cpp') + ['core/version.cpp'],
|
source=bld.path.find_dir('core').ant_glob('*.cpp') + ['core/version.cpp'],
|
||||||
use='version.cpp version.hpp NDN_CXX BOOST LIBRT',
|
use='version.cpp version.hpp BOOST NDN_CXX LIBRT',
|
||||||
includes='.',
|
includes='.',
|
||||||
export_includes='.')
|
export_includes='.')
|
||||||
|
|
||||||
@@ -199,9 +199,10 @@ def build(bld):
|
|||||||
source='daemon/main.cpp',
|
source='daemon/main.cpp',
|
||||||
use='daemon-objects SYSTEMD')
|
use='daemon-objects SYSTEMD')
|
||||||
|
|
||||||
bld.recurse('tools')
|
|
||||||
bld.recurse('tests')
|
bld.recurse('tests')
|
||||||
|
bld.recurse('tools')
|
||||||
|
|
||||||
|
# Install sample configs
|
||||||
bld(features='subst',
|
bld(features='subst',
|
||||||
source='nfd.conf.sample.in',
|
source='nfd.conf.sample.in',
|
||||||
target='nfd.conf.sample',
|
target='nfd.conf.sample',
|
||||||
@@ -209,7 +210,6 @@ def build(bld):
|
|||||||
IF_HAVE_LIBPCAP='' if bld.env.HAVE_LIBPCAP else '; ',
|
IF_HAVE_LIBPCAP='' if bld.env.HAVE_LIBPCAP else '; ',
|
||||||
IF_HAVE_WEBSOCKET='' if bld.env.HAVE_WEBSOCKET else '; ',
|
IF_HAVE_WEBSOCKET='' if bld.env.HAVE_WEBSOCKET else '; ',
|
||||||
UNIX_SOCKET_PATH='/run/nfd.sock' if Utils.unversioned_sys_platform() == 'linux' else '/var/run/nfd.sock')
|
UNIX_SOCKET_PATH='/run/nfd.sock' if Utils.unversioned_sys_platform() == 'linux' else '/var/run/nfd.sock')
|
||||||
|
|
||||||
bld.install_files('${SYSCONFDIR}/ndn', 'autoconfig.conf.sample')
|
bld.install_files('${SYSCONFDIR}/ndn', 'autoconfig.conf.sample')
|
||||||
|
|
||||||
if bld.env.HAVE_SYSTEMD:
|
if bld.env.HAVE_SYSTEMD:
|
||||||
|
|||||||
Reference in new issue
Block a user