Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
Expand Down
3 changes: 3 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions external/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}
)

Expand Down
11 changes: 10 additions & 1 deletion src/async_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -93,7 +98,11 @@ void AsyncReader::doRead(std::size_t bytesToRead)

const void* AsyncReader::data() const
{
return boost::asio::buffer_cast<const void*>(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)
Expand Down
4 changes: 4 additions & 0 deletions src/async_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down