From 59282f764d77e58d2e3dcc411ca8ea1636682935 Mon Sep 17 00:00:00 2001 From: Alex Kremer Date: Mon, 12 May 2025 19:05:43 +0100 Subject: [PATCH] fix: Guarantee async behaviour of WsBase::send (#2100) --- src/web/impl/WsBase.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/web/impl/WsBase.hpp b/src/web/impl/WsBase.hpp index 9be6b334..bdd6d860 100644 --- a/src/web/impl/WsBase.hpp +++ b/src/web/impl/WsBase.hpp @@ -173,7 +173,8 @@ public: void send(std::shared_ptr 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_) {