chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.85k stars 1.2k forks source link

Fix channel try_send failure after cancel #1242

Closed erinacio closed 1 year ago

erinacio commented 1 year ago

The only case when impl.send_state_ becomes waiter seems to be that an async_receive is awaiting on an empty channel, as found in channel_service.hpp:557. As an empty channel, when no one is awaiting on it, whether send_state_ is buffer or block should solely depend on whether the channel itself is buffered or not.

Fixes https://github.com/chriskohlhoff/asio/issues/1241

vinipsmaker commented 1 year ago

Landed in master: https://github.com/chriskohlhoff/asio/commit/efec5c197d29b329e16f98000695a1f98cfa65df

Please close the PR.