From: Christopher Faulet Date: Tue, 3 Feb 2026 06:53:13 +0000 (+0100) Subject: MEDIUM: stconn: Properly handle large buffers during a receive X-Git-Tag: v3.4-dev5~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd25c630678a8ab605b944706b516d4a209d7240;p=thirdparty%2Fhaproxy.git MEDIUM: stconn: Properly handle large buffers during a receive While large buffers are still unused internally, functions receiving data from endpoint (connections or applets) were updated to block the receives when channels are using large buffer and the data forwarding was started. The goal of this patch is to be able to flush large buffers at the end of the analyzis stage to return asap on regular buffers. --- diff --git a/src/stconn.c b/src/stconn.c index c4a96d4fe..770722d13 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -1378,6 +1378,10 @@ int sc_conn_recv(struct stconn *sc) if (!sc_alloc_ibuf(sc, &(__sc_strm(sc)->buffer_wait))) goto end_recv; + if ((ic->flags & CF_WROTE_DATA) && b_size(sc_ib(sc)) > global.tune.bufsize) { + sc_need_room(sc, -1); + goto done_recv; + } /* For an HTX stream, if the buffer is stuck (no output data with some * input data) and if the HTX message is fragmented or if its free space * wraps, we force an HTX deframentation. It is a way to have a @@ -2063,6 +2067,11 @@ int sc_applet_recv(struct stconn *sc) if (!sc_alloc_ibuf(sc, &appctx->buffer_wait)) goto end_recv; + if ((ic->flags & CF_WROTE_DATA) && b_size(sc_ib(sc)) > global.tune.bufsize) { + sc_need_room(sc, -1); + goto done_recv; + } + /* For an HTX stream, if the buffer is stuck (no output data with some * input data) and if the HTX message is fragmented or if its free space * wraps, we force an HTX deframentation. It is a way to have a