From 706f3add8ed4b1419f7192e5847462a6aae5f537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE?= Date: Mon, 12 Jan 2026 10:28:44 +0100 Subject: [PATCH 1/3] Bump boost to 1.90.0 with complementary changes --- CMakeLists.txt | 2 +- external/boost/CMakeLists.txt | 10 +++++----- src/async_reader.cpp | 8 ++++++-- src/async_writer.cpp | 2 +- src/client.cpp | 2 +- src/session.cpp | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fba5a11..7ec3e2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.24) -project(native_streaming VERSION 1.0.19 LANGUAGES CXX) +project(native_streaming VERSION 1.0.20 LANGUAGES CXX) if (NOT CMAKE_MESSAGE_CONTEXT) set(CMAKE_MESSAGE_CONTEXT ${PROJECT_NAME}) diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt index a836631..3f34c00 100644 --- a/external/boost/CMakeLists.txt +++ b/external/boost/CMakeLists.txt @@ -5,10 +5,10 @@ add_library(daq::native_streaming::boost_websocket ALIAS boost_websocket) target_compile_definitions(boost_websocket INTERFACE BOOST_ALL_NO_LIB) # using only asio and beast -# handle Boost depencies here only if not already handled by parent project +# handle Boost dependencies here only if not already handled by parent project if (NOT TARGET Boost::beast) - set(Boost_MINVERSION "1.71.0") - set(Boost_REQUIREDVERSION "1.82.0") + set(Boost_MINVERSION "1.90.0") + set(Boost_REQUIREDVERSION "1.90.0") set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_LIBS ON) @@ -26,8 +26,8 @@ if (NOT TARGET Boost::beast) else (Boost_FOUND) message(STATUS "Fetching Boost ${Boost_REQUIREDVERSION}...") FetchContent_Declare(Boost - URL https://github.com/boostorg/boost/releases/download/boost-${Boost_REQUIREDVERSION}/boost-${Boost_REQUIREDVERSION}.tar.xz - URL_HASH SHA256=fd60da30be908eff945735ac7d4d9addc7f7725b1ff6fcdcaede5262d511d21e + URL https://github.com/boostorg/boost/releases/download/boost-${Boost_REQUIREDVERSION}/boost-${Boost_REQUIREDVERSION}-cmake.tar.xz + URL_HASH SHA256=aca59f889f0f32028ad88ba6764582b63c916ce5f77b31289ad19421a96c555f ${FC_PARAMS} ) diff --git a/src/async_reader.cpp b/src/async_reader.cpp index 3875a94..389889a 100644 --- a/src/async_reader.cpp +++ b/src/async_reader.cpp @@ -31,7 +31,7 @@ void AsyncReader::scheduleRead(const ReadTask& entryTask) assert(entryTask.getHandler() != nullptr); assert(entryTask.getSize() != 0); pendingTask = entryTask; - ioContextRef.post(strand.wrap( + post(strand.wrap( [this, shared_self = shared_from_this()]() { doRead(pendingTask.getSize()); @@ -93,7 +93,11 @@ void AsyncReader::doRead(std::size_t bytesToRead) const void* AsyncReader::data() const { - return boost::asio::buffer_cast(buffer.data()); + auto bufs = buffer.data(); + auto it = boost::asio::buffer_sequence_begin(bufs); + if (it == boost::asio::buffer_sequence_end(bufs)) + return nullptr; + return it->data(); } void AsyncReader::consume(size_t size) diff --git a/src/async_writer.cpp b/src/async_writer.cpp index 3615e38..514b309 100644 --- a/src/async_writer.cpp +++ b/src/async_writer.cpp @@ -17,7 +17,7 @@ AsyncWriter::AsyncWriter(boost::asio::io_context& ioContextRef, std::shared_ptr< void AsyncWriter::scheduleWrite(BatchedWriteTasks&& tasks, OptionalWriteDeadline&& deadlineTime) { - ioContextRef.post(strand.wrap( + post(strand.wrap( [this, tasks = std::move(tasks), deadlineTime = std::move(deadlineTime), shared_self = shared_from_this()]() mutable { queueBatchWrite(std::move(tasks), std::move(deadlineTime)); diff --git a/src/client.cpp b/src/client.cpp index 7fa371b..5c563d3 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -41,7 +41,7 @@ void Client::connect(const std::chrono::milliseconds& timeout) NS_LOG_I("connecting to server: host {}, port {}, path {}", host, port, path); connectionTimeoutTimer.cancel(); - connectionTimeoutTimer.expires_from_now(timeout); + connectionTimeoutTimer.expires_after(timeout); connectionTimeoutTimer.async_wait( [this, weak_self = weak_from_this()](const boost::system::error_code& ec) { diff --git a/src/session.cpp b/src/session.cpp index 7991993..21a694e 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -110,7 +110,7 @@ void Session::scheduleWrite(BatchedWriteTasks&& tasks, OptionalWriteDeadline&& d void Session::restartHeartbeatTimer() { - heartbeatTimer->expires_from_now(heartbeatPeriod); + heartbeatTimer->expires_after(heartbeatPeriod); heartbeatTimer->async_wait( [this, weak_self = weak_from_this()](const boost::system::error_code& ec) { From 336347d5d93bcc42fe704faa94648983c6413262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE?= Date: Mon, 12 Jan 2026 10:41:12 +0100 Subject: [PATCH 2/3] Adjust the changelog --- changelog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog b/changelog index 5823d90..0aa1b9f 100644 --- a/changelog +++ b/changelog @@ -51,3 +51,6 @@ ## v1.0.15 - Fix issue with retrieving connection endpoint name on server app resuming in debug mode + +## v1.0.20 + - Bump boost version to 1.90.0 From fb8ebb8e3b2e602849c1d346ff7ac44ec8729152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE?= Date: Mon, 19 Jan 2026 14:54:57 +0100 Subject: [PATCH 3/3] Lower `Boost_MINVERSION` to 1.71.0 and add compatibility for older Boost versions --- external/boost/CMakeLists.txt | 2 +- src/async_reader.cpp | 5 +++++ src/async_writer.cpp | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt index 3f34c00..cebfd1a 100644 --- a/external/boost/CMakeLists.txt +++ b/external/boost/CMakeLists.txt @@ -7,7 +7,7 @@ target_compile_definitions(boost_websocket INTERFACE BOOST_ALL_NO_LIB) # using only asio and beast # handle Boost dependencies here only if not already handled by parent project if (NOT TARGET Boost::beast) - set(Boost_MINVERSION "1.90.0") + set(Boost_MINVERSION "1.71.0") set(Boost_REQUIREDVERSION "1.90.0") set(Boost_USE_MULTITHREADED ON) diff --git a/src/async_reader.cpp b/src/async_reader.cpp index 389889a..2eb3d1d 100644 --- a/src/async_reader.cpp +++ b/src/async_reader.cpp @@ -31,7 +31,12 @@ void AsyncReader::scheduleRead(const ReadTask& entryTask) assert(entryTask.getHandler() != nullptr); assert(entryTask.getSize() != 0); pendingTask = entryTask; + +#if BOOST_VERSION >= 109000 post(strand.wrap( +#else + ioContextRef.post(strand.wrap( +#endif [this, shared_self = shared_from_this()]() { doRead(pendingTask.getSize()); diff --git a/src/async_writer.cpp b/src/async_writer.cpp index 514b309..17a5df7 100644 --- a/src/async_writer.cpp +++ b/src/async_writer.cpp @@ -17,7 +17,11 @@ AsyncWriter::AsyncWriter(boost::asio::io_context& ioContextRef, std::shared_ptr< void AsyncWriter::scheduleWrite(BatchedWriteTasks&& tasks, OptionalWriteDeadline&& deadlineTime) { +#if BOOST_VERSION >= 109000 post(strand.wrap( +#else + ioContextRef.post(strand.wrap( +#endif [this, tasks = std::move(tasks), deadlineTime = std::move(deadlineTime), shared_self = shared_from_this()]() mutable { queueBatchWrite(std::move(tasks), std::move(deadlineTime));