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 {