Currently, async_base::complete passes the handler to dispatch, which may not have an associated executor. However, the operation itself (async_base) is tied to the stream's default executor. This can lead to the handler being executed on an unexpected or incorrect execution context:
|
auto const ex = this->get_immediate_executor(); |
|
net::dispatch( |
|
ex, |
|
net::append(std::move(h_), std::forward<Args>(args)...)); |
|
wg1_.reset(); |