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/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 diff --git a/external/boost/CMakeLists.txt b/external/boost/CMakeLists.txt index a836631..cebfd1a 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_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..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()); @@ -93,7 +98,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..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)); 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) {