build: require boost >= 1.71.0
Refs: #5276
Change-Id: I287a52dab0212d1ce0da77afb563554214cac68a
diff --git a/src/interest-table.cpp b/src/interest-table.cpp
index 8b98316..9eef231 100644
--- a/src/interest-table.cpp
+++ b/src/interest-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2019 University of California, Los Angeles
+ * Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -26,7 +26,7 @@
namespace chronosync {
-InterestTable::InterestTable(boost::asio::io_service& io)
+InterestTable::InterestTable(boost::asio::io_context& io)
: m_scheduler(io)
{
}
diff --git a/src/interest-table.hpp b/src/interest-table.hpp
index 4fc3eb4..ea26b13 100644
--- a/src/interest-table.hpp
+++ b/src/interest-table.hpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2021 University of California, Los Angeles
+ * Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -27,12 +27,12 @@
#include "interest-container.hpp"
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
namespace chronosync {
/**
- * @brief A table to keep unsatisfied Sync Interest
+ * @brief A table to keep unsatisfied Sync Interests.
*/
class InterestTable : noncopyable
{
@@ -47,7 +47,7 @@
using const_iterator = InterestContainer::const_iterator;
explicit
- InterestTable(boost::asio::io_service& io);
+ InterestTable(boost::asio::io_context& io);
~InterestTable();
diff --git a/tests/unit-test-time-fixture.hpp b/tests/unit-test-time-fixture.hpp
index a8b46f7..1d98ab2 100644
--- a/tests/unit-test-time-fixture.hpp
+++ b/tests/unit-test-time-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2022 University of California, Los Angeles
+ * Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -22,7 +22,7 @@
#include <ndn-cxx/util/time-unit-test-clock.hpp>
-#include <boost/asio.hpp>
+#include <boost/asio/io_context.hpp>
namespace ndn::tests {
@@ -42,14 +42,15 @@
}
void
- advanceClocks(const time::nanoseconds& tick, size_t nTicks = 1)
+ advanceClocks(time::nanoseconds tick, size_t nTicks = 1)
{
for (size_t i = 0; i < nTicks; ++i) {
steadyClock->advance(tick);
systemClock->advance(tick);
- if (io.stopped())
- io.reset();
+ if (io.stopped()) {
+ io.restart();
+ }
io.poll();
}
}
@@ -57,7 +58,7 @@
public:
shared_ptr<time::UnitTestSteadyClock> steadyClock;
shared_ptr<time::UnitTestSystemClock> systemClock;
- boost::asio::io_service io;
+ boost::asio::io_context io;
};
} // namespace ndn::tests
diff --git a/tests/unit-tests/dummy-forwarder.cpp b/tests/unit-tests/dummy-forwarder.cpp
index 2bcc3bc..ca43032 100644
--- a/tests/unit-tests/dummy-forwarder.cpp
+++ b/tests/unit-tests/dummy-forwarder.cpp
@@ -19,12 +19,13 @@
#include "dummy-forwarder.hpp"
-#include <boost/asio/io_service.hpp>
+#include <boost/asio/io_context.hpp>
+#include <boost/asio/post.hpp>
namespace ndn {
namespace chronosync {
-DummyForwarder::DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain)
+DummyForwarder::DummyForwarder(boost::asio::io_context& io, KeyChain& keyChain)
: m_io(io)
, m_keyChain(keyChain)
{
@@ -42,7 +43,7 @@
if (self == &*otherFace) {
continue;
}
- m_io.post([=] { otherFace->receive(i); });
+ boost::asio::post(m_io, [=] { otherFace->receive(i); });
}
});
@@ -52,7 +53,7 @@
if (self == &*otherFace) {
continue;
}
- m_io.post([=] { otherFace->receive(d); });
+ boost::asio::post(m_io, [=] { otherFace->receive(d); });
}
});
@@ -62,7 +63,7 @@
if (self == &*otherFace) {
continue;
}
- m_io.post([=] { otherFace->receive(n); });
+ boost::asio::post(m_io, [=] { otherFace->receive(n); });
}
});
diff --git a/tests/unit-tests/dummy-forwarder.hpp b/tests/unit-tests/dummy-forwarder.hpp
index 60e6904..372186e 100644
--- a/tests/unit-tests/dummy-forwarder.hpp
+++ b/tests/unit-tests/dummy-forwarder.hpp
@@ -38,7 +38,7 @@
class DummyForwarder
{
public:
- DummyForwarder(boost::asio::io_service& io, KeyChain& keyChain);
+ DummyForwarder(boost::asio::io_context& io, KeyChain& keyChain);
Face&
addFace();
@@ -53,7 +53,7 @@
removeFaces();
private:
- boost::asio::io_service& m_io;
+ boost::asio::io_context& m_io;
KeyChain& m_keyChain;
std::vector<std::shared_ptr<DummyClientFace>> m_faces;
};
diff --git a/tests/unit-tests/test-logic.cpp b/tests/unit-tests/test-logic.cpp
index 1a1257a..3cd7f9d 100644
--- a/tests/unit-tests/test-logic.cpp
+++ b/tests/unit-tests/test-logic.cpp
@@ -363,7 +363,7 @@
systemClock->advance(ndn::time::hours(1));
BOOST_CHECK_EQUAL(io.poll(), 0); // no delayed handlers are expected
- BOOST_CHECK_EQUAL(io.stopped(), true); // io_service expected to be stopped
+ BOOST_CHECK_EQUAL(io.stopped(), true); // io_context expected to be stopped
}
BOOST_FIXTURE_TEST_CASE(TrimState, ndn::tests::IdentityManagementTimeFixture)
diff --git a/tests/unit-tests/test-multiple-user.cpp b/tests/unit-tests/test-multiple-user.cpp
index b8a5dbd..83d00da 100644
--- a/tests/unit-tests/test-multiple-user.cpp
+++ b/tests/unit-tests/test-multiple-user.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
- * Copyright (c) 2012-2022 University of California, Los Angeles
+ * Copyright (c) 2012-2023 University of California, Los Angeles
*
* This file is part of ChronoSync, synchronization library for distributed realtime
* applications for NDN.
@@ -72,7 +72,7 @@
Name syncPrefix;
Name userPrefix[3];
- boost::asio::io_service io;
+ boost::asio::io_context io;
shared_ptr<ndn::Face> face;
ndn::Scheduler scheduler;
shared_ptr<Handler> handler;
diff --git a/wscript b/wscript
index 0241a04..ea3916f 100644
--- a/wscript
+++ b/wscript
@@ -38,6 +38,10 @@
uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)
conf.check_boost(lib='iostreams', mt=True)
+ if conf.env.BOOST_VERSION_NUMBER < 107100:
+ conf.fatal('The minimum supported version of Boost is 1.71.0.\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')
if conf.env.WITH_TESTS:
conf.check_boost(lib='filesystem unit_test_framework', mt=True, uselib_store='BOOST_TESTS')