Skip to content

async_base::complete dispatches handler without using the operation's associated executor #3047

@ashtum

Description

@ashtum

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();

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions