From 62b5feb540d69d800d16c2ae253493d1c732e268 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Thu, 11 May 2023 12:48:12 +0200 Subject: [PATCH] We need uncorkWithoutSending --- src/AsyncSocket.h | 6 ++++++ src/WebSocket.h | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/AsyncSocket.h b/src/AsyncSocket.h index a7ac631..7a93608 100644 --- a/src/AsyncSocket.h +++ b/src/AsyncSocket.h @@ -123,6 +123,12 @@ protected: getLoopData()->corkedSocket = this; } + void uncorkWithoutSending() { + if (isCorked()) { + getLoopData()->corkedSocket = nullptr; + } + } + /* Cork this socket. Only one socket may ever be corked per-loop at any given time */ void cork() { /* Extra check for invalid corking of others */ diff --git a/src/WebSocket.h b/src/WebSocket.h index d0f2d70..c8431b6 100644 --- a/src/WebSocket.h +++ b/src/WebSocket.h @@ -119,8 +119,10 @@ public: } else { webSocketData->buffer.append(header + written, (size_t) header_length - (size_t) written); } - /* We cannot still be corked if we have backpressure */ - Super::uncork(); + /* We cannot still be corked if we have backpressure. + * We also cannot uncork normally since it will re-write the already buffered + * up backpressure again. */ + Super::uncorkWithoutSending(); return BACKPRESSURE; } } else {