From 719f1a550518b9970be2648fbedbc88fd18561d1 Mon Sep 17 00:00:00 2001 From: Richard Hodges Date: Fri, 3 Jul 2020 07:57:00 +0200 Subject: [PATCH] Fix websocket stream when using net.ts executor type --- .../beast/websocket/impl/stream_impl.hpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/include/boost/beast/websocket/impl/stream_impl.hpp b/include/boost/beast/websocket/impl/stream_impl.hpp index f2d73924..53e18157 100644 --- a/include/boost/beast/websocket/impl/stream_impl.hpp +++ b/include/boost/beast/websocket/impl/stream_impl.hpp @@ -128,8 +128,8 @@ struct stream::impl_type boost::empty_init_t{}, std::forward(args)...) , detail::service::impl_type( - net::query(this->boost::empty_value::get().get_executor(), - net::execution::context)) + this->get_context( + this->boost::empty_value::get().get_executor())) , timer(this->boost::empty_value::get().get_executor()) { timeout_opt.handshake_timeout = none(); @@ -477,6 +477,22 @@ struct stream::impl_type } private: + template + static net::execution_context& + get_context(Executor const& ex, + typename std::enable_if< net::execution::is_executor::value >::type* = 0) + { + return net::query(ex, net::execution::context); + } + + template + static net::execution_context& + get_context(Executor const& ex, + typename std::enable_if< !net::execution::is_executor::value >::type* = 0) + { + return ex.context(); + } + bool is_timer_set() const {