From 292b00c4c35ca94580529a157adc885e9094bb19 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Wed, 15 Sep 2021 02:38:42 +0200 Subject: [PATCH] Fix requiresWrite uncorking bug --- src/WebSocket.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/WebSocket.h b/src/WebSocket.h index 389cae5..6ed3497 100644 --- a/src/WebSocket.h +++ b/src/WebSocket.h @@ -120,6 +120,12 @@ public: protocol::formatMessage(sendBuffer, message.data(), message.length(), opCode, message.length(), compress); /* This is the slow path, when we couldn't cork for the user */ if (requiresWrite) { + /* We tried corking for the user but in the end we did not even fit in the cork buffer */ + if (automaticallyCorked) { + Super::uncork(); + automaticallyCorked = false; + } + auto[written, failed] = Super::write(sendBuffer, (int) messageFrameSize); /* For now, we are slow here */