fix: Guarantee async behaviour of WsBase::send (#2100)

This commit is contained in:
Alex Kremer
2025-05-12 19:05:43 +01:00
committed by GitHub
parent 0cdfad3731
commit 59282f764d

View File

@@ -173,7 +173,8 @@ public:
void
send(std::shared_ptr<std::string> msg) override
{
boost::asio::dispatch(
// Note: post used instead of dispatch to guarantee async behavior of wsFail and maybeSendNext
boost::asio::post(
derived().ws().get_executor(),
[this, self = derived().shared_from_this(), msg = std::move(msg)]() {
if (messages_.size() > maxSendingQueueSize_) {