From 334b9871bed6c348fcdda0c46aba74c46968c762 Mon Sep 17 00:00:00 2001 From: Klemens Date: Fri, 23 Dec 2022 16:54:55 +0800 Subject: [PATCH] Fixed timer usage inside basic_stream. Closes #2602. --- include/boost/beast/websocket/impl/stream_impl.hpp | 5 +++-- test/beast/core/tcp_stream.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/boost/beast/websocket/impl/stream_impl.hpp b/include/boost/beast/websocket/impl/stream_impl.hpp index b3042e33..d32f1dc9 100644 --- a/include/boost/beast/websocket/impl/stream_impl.hpp +++ b/include/boost/beast/websocket/impl/stream_impl.hpp @@ -68,8 +68,9 @@ struct stream::impl_type impl_type>(this->detail::service:: impl_type::shared_from_this()); } - - net::steady_timer timer; // used for timeouts + using executor_type = typename std::decay::type::executor_type; + typename net::steady_timer::rebind_executor::other + timer; // used for timeouts close_reason cr; // set from received close frame control_cb_type ctrl_cb; // control callback diff --git a/test/beast/core/tcp_stream.cpp b/test/beast/core/tcp_stream.cpp index 50e0ef2e..b03b8b4d 100644 --- a/test/beast/core/tcp_stream.cpp +++ b/test/beast/core/tcp_stream.cpp @@ -15,6 +15,12 @@ namespace boost { namespace beast { +// compile test for other exec +template class basic_stream< + net::ip::tcp, + net::io_context::executor_type, + unlimited_rate_policy> ; + class tcp_stream_test : public beast::unit_test::suite {