From: Willy Tarreau Date: Tue, 7 May 2024 18:09:04 +0000 (+0200) Subject: MINOR: applet: adjust the allocation criticity based on the requested buffer X-Git-Tag: v3.0-dev11~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a42af17440d9eb09ea7fb699924297871c7b760;p=thirdparty%2Fhaproxy.git MINOR: applet: adjust the allocation criticity based on the requested buffer When we want to allocate an in buffer, it's in order to pass data to the applet, that will consume it, so it must be seen as the same as a send() from the higher level, i.e. MUX_TX. And for the outbuf, it's a stream endpoint returning data, i.e. DB_SE_RX. --- diff --git a/include/haproxy/applet.h b/include/haproxy/applet.h index e2762458fc..2beacf4e45 100644 --- a/include/haproxy/applet.h +++ b/include/haproxy/applet.h @@ -95,8 +95,8 @@ static inline struct buffer *appctx_get_buf(struct appctx *appctx, struct buffer int is_inbuf = (bptr == &appctx->inbuf); if (likely(!LIST_INLIST(&appctx->buffer_wait.list))) { - if (unlikely((buf = b_alloc(bptr, DB_SE_RX)) == NULL)) { - b_queue(DB_SE_RX, &appctx->buffer_wait, appctx, appctx_buf_available); + if (unlikely((buf = b_alloc(bptr, is_inbuf ? DB_MUX_TX : DB_SE_RX)) == NULL)) { + b_queue(is_inbuf ? DB_MUX_TX : DB_SE_RX, &appctx->buffer_wait, appctx, appctx_buf_available); applet_fl_set(appctx, is_inbuf ? APPCTX_FL_INBLK_ALLOC : APPCTX_FL_OUTBLK_ALLOC); } }