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
This commit is contained in:
Bruno Iljazovic
2025-01-14 14:13:23 +01:00
parent afc270f10e
commit 9a0d41b7a7
3 changed files with 21 additions and 12 deletions

View File

@ -111,7 +111,7 @@ public:
} }
void operator()(std::array<std::size_t, 3> /* ord */) { void operator()(std::array<std::size_t, 3> /* ord */) {
_handler.complete(asio::error::operation_aborted); _handler.complete(make_error_code(asio::error::operation_aborted));
} }
}; };

View File

@ -66,7 +66,8 @@ public:
/// The client type when rebound to the specified executor. /// The client type when rebound to the specified executor.
using other = mqtt_client< using other = mqtt_client<
typename detail::rebind_executor<StreamType, Executor>::other, typename detail::rebind_executor<StreamType, Executor>::other,
TlsContext TlsContext,
LoggerType
>; >;
}; };

View File

@ -46,16 +46,20 @@ namespace test {
// the following code needs to compile // the following code needs to compile
template <typename StreamType, typename TlsContextType = std::monostate> template <
typename StreamType,
typename TlsContextType = std::monostate,
typename Logger = noop_logger
>
asio::awaitable<void> test_default_completion_tokens_impl( asio::awaitable<void> test_default_completion_tokens_impl(
TlsContextType tls_context = {} TlsContextType tls_context = {}, Logger logger = {}
) { ) {
asio::io_context ioc; asio::io_context ioc;
using client_type = asio::use_awaitable_t<>::as_default_on_t< using client_type = asio::use_awaitable_t<>::as_default_on_t<
mqtt_client<StreamType, TlsContextType> mqtt_client<StreamType, TlsContextType, Logger>
>; >;
client_type c(ioc, std::move(tls_context)); client_type c(ioc, std::move(tls_context), std::move(logger));
co_await c.async_run(); co_await c.async_run();
@ -94,10 +98,14 @@ asio::awaitable<void> test_default_completion_tokens() {
boost::beast::websocket::stream<asio::ip::tcp::socket> boost::beast::websocket::stream<asio::ip::tcp::socket>
>(); >();
co_await test_default_completion_tokens_impl< co_await test_default_completion_tokens_impl<
boost::beast::websocket::stream<asio::ssl::stream<asio::ip::tcp::socket>>, boost::beast::websocket::stream<asio::ssl::stream<asio::ip::tcp::socket>>,
asio::ssl::context asio::ssl::context,
>(asio::ssl::context(asio::ssl::context::tls_client)); logger
>(
asio::ssl::context(asio::ssl::context::tls_client),
logger(log_level::debug)
);
} }
} // end namespace test } // end namespace test