Refactor get_io_context

This commit is contained in:
Richard Hodges
2020-07-04 07:35:06 +02:00
parent 107b01ad24
commit 5f1adfbc6d
2 changed files with 37 additions and 5 deletions
@@ -34,7 +34,7 @@ inline
net::io_context*
get_io_context(net::io_context::executor_type const& ex)
{
return std::addressof(ex.context());
return std::addressof(net::query(ex, net::execution::context));
}
inline
@@ -42,8 +42,7 @@ net::io_context*
get_io_context(net::strand<
net::io_context::executor_type> const& ex)
{
return std::addressof(
ex.get_inner_executor().context());
return get_io_context(ex.get_inner_executor());
}
template<class Executor>
@@ -64,7 +63,7 @@ get_io_context(T const& ex)
net::io_context::executor_type>();
if(! p)
return nullptr;
return std::addressof(p->context());
return get_io_context(*p);
}
inline