From 82a437999a183fc3cf8a35e2aa96f6ea406d9b6f Mon Sep 17 00:00:00 2001 From: Bruno Iljazovic Date: Tue, 14 Jan 2025 14:13:23 +0100 Subject: [PATCH] fix for default completion tokens on Boost 1.87.0 Reviewers: ivica Reviewed By: ivica Subscribers: korina, miljen Differential Revision: https://repo.mireo.local/D33181 --- include/async_mqtt5/impl/run_op.hpp | 2 +- include/async_mqtt5/mqtt_client.hpp | 3 ++- test/unit/default_completion_tokens.cpp | 20 ++++++++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/async_mqtt5/impl/run_op.hpp b/include/async_mqtt5/impl/run_op.hpp index b8d7eab..6a06811 100644 --- a/include/async_mqtt5/impl/run_op.hpp +++ b/include/async_mqtt5/impl/run_op.hpp @@ -111,7 +111,7 @@ public: } void operator()(std::array /* ord */) { - _handler.complete(asio::error::operation_aborted); + _handler.complete(make_error_code(asio::error::operation_aborted)); } }; diff --git a/include/async_mqtt5/mqtt_client.hpp b/include/async_mqtt5/mqtt_client.hpp index f83942e..6ec72b1 100644 --- a/include/async_mqtt5/mqtt_client.hpp +++ b/include/async_mqtt5/mqtt_client.hpp @@ -66,7 +66,8 @@ public: /// The client type when rebound to the specified executor. using other = mqtt_client< typename detail::rebind_executor::other, - TlsContext + TlsContext, + LoggerType >; }; diff --git a/test/unit/default_completion_tokens.cpp b/test/unit/default_completion_tokens.cpp index 3458821..baed2a0 100644 --- a/test/unit/default_completion_tokens.cpp +++ b/test/unit/default_completion_tokens.cpp @@ -46,16 +46,20 @@ namespace test { // the following code needs to compile -template +template < + typename StreamType, + typename TlsContextType = std::monostate, + typename Logger = noop_logger +> asio::awaitable test_default_completion_tokens_impl( - TlsContextType tls_context = {} + TlsContextType tls_context = {}, Logger logger = {} ) { asio::io_context ioc; using client_type = asio::use_awaitable_t<>::as_default_on_t< - mqtt_client + mqtt_client >; - client_type c(ioc, std::move(tls_context)); + client_type c(ioc, std::move(tls_context), std::move(logger)); co_await c.async_run(); @@ -96,8 +100,12 @@ asio::awaitable test_default_completion_tokens() { co_await test_default_completion_tokens_impl< boost::beast::websocket::stream>, - asio::ssl::context - >(asio::ssl::context(asio::ssl::context::tls_client)); + asio::ssl::context, + logger + >( + asio::ssl::context(asio::ssl::context::tls_client), + logger(log_level::debug) + ); } } // end namespace test