From 1af7949d1b32fba5213a8a4633e43a6fc8a071bc Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Fri, 22 Sep 2023 15:45:21 -0400 Subject: [PATCH] build: require boost >= 1.71.0 Refs: #5276 Change-Id: I287a52dab0212d1ce0da77afb563554214cac68a --- src/interest-table.cpp | 4 ++-- src/interest-table.hpp | 8 ++++---- tests/unit-test-time-fixture.hpp | 13 +++++++------ tests/unit-tests/dummy-forwarder.cpp | 11 ++++++----- tests/unit-tests/dummy-forwarder.hpp | 4 ++-- tests/unit-tests/test-logic.cpp | 2 +- tests/unit-tests/test-multiple-user.cpp | 4 ++-- wscript | 4 ++++ 8 files changed, 28 insertions(+), 22 deletions(-) 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 +#include 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 @@ public: 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 -#include +#include namespace ndn::tests { @@ -42,14 +42,15 @@ public: } 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: public: shared_ptr steadyClock; shared_ptr 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 +#include +#include 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 @@ DummyForwarder::addFace() if (self == &*otherFace) { continue; } - m_io.post([=] { otherFace->receive(i); }); + boost::asio::post(m_io, [=] { otherFace->receive(i); }); } }); @@ -52,7 +53,7 @@ DummyForwarder::addFace() if (self == &*otherFace) { continue; } - m_io.post([=] { otherFace->receive(d); }); + boost::asio::post(m_io, [=] { otherFace->receive(d); }); } }); @@ -62,7 +63,7 @@ DummyForwarder::addFace() 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 @@ namespace chronosync { 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 @@ public: removeFaces(); private: - boost::asio::io_service& m_io; + boost::asio::io_context& m_io; KeyChain& m_keyChain; std::vector> 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 @@ BOOST_AUTO_TEST_CASE(CancelOutstandingEvents) 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 @@ public: Name syncPrefix; Name userPrefix[3]; - boost::asio::io_service io; + boost::asio::io_context io; shared_ptr face; ndn::Scheduler scheduler; shared_ptr handler; diff --git a/wscript b/wscript index 0241a04..ea3916f 100644 --- a/wscript +++ b/wscript @@ -38,6 +38,10 @@ def configure(conf): 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')