]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: dynbuf: generalize the use of b_dequeue() to detach buffer_wait
authorWilly Tarreau <w@1wt.eu>
Wed, 24 Apr 2024 16:44:03 +0000 (18:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 May 2024 15:18:13 +0000 (17:18 +0200)
Now thanks to this the bufq_map field is expected to remain accurate.

include/haproxy/applet.h
src/applet.c
src/check.c
src/flt_spoe.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/stream.c

index 953e13cb708e7bac65ec112afbc7307019e94039..663f89035893686a29f0be8178a946472362bd6c 100644 (file)
@@ -121,8 +121,7 @@ static inline void __appctx_free(struct appctx *appctx)
        appctx_release_buf(appctx, &appctx->outbuf);
 
        task_destroy(appctx->t);
-       if (LIST_INLIST(&appctx->buffer_wait.list))
-               LIST_DEL_INIT(&appctx->buffer_wait.list);
+       b_dequeue(&appctx->buffer_wait);
        if (appctx->sess)
                session_free(appctx->sess);
        BUG_ON(appctx->sedesc && !se_fl_test(appctx->sedesc, SE_FL_ORPHAN));
index dca53e7888c03eb8eb223d5b0501aa810f9a63a8..029782979008876964106062beff243c4d12283e 100644 (file)
@@ -405,8 +405,7 @@ void appctx_shut(struct appctx *appctx)
                appctx->applet->release(appctx);
        applet_fl_set(appctx, APPCTX_FL_SHUTDOWN);
 
-       if (LIST_INLIST(&appctx->buffer_wait.list))
-               LIST_DEL_INIT(&appctx->buffer_wait.list);
+       b_dequeue(&appctx->buffer_wait);
 
        TRACE_LEAVE(APPLET_EV_RELEASE, appctx);
 }
index d00ea265a8e818c9a8aa096ea63055d4c0038e5b..64464c4f4f85eff121115351c2d7a5ca4bfccd71 100644 (file)
@@ -1415,8 +1415,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
                }
        }
 
-        if (LIST_INLIST(&check->buf_wait.list))
-                LIST_DEL_INIT(&check->buf_wait.list);
+       b_dequeue(&check->buf_wait);
 
        check_release_buf(check, &check->bi);
        check_release_buf(check, &check->bo);
index f8718f01a544c3cc84aecce60af0447a59d78183..2ac03d6d28074c23a95c04b6a03ac585b5bbc4df 100644 (file)
@@ -2852,8 +2852,7 @@ spoe_acquire_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
        if (buf->size)
                return 1;
 
-       if (LIST_INLIST(&buffer_wait->list))
-               LIST_DEL_INIT(&buffer_wait->list);
+       b_dequeue(buffer_wait);
 
        if (b_alloc(buf, DB_CHANNEL))
                return 1;
@@ -2865,8 +2864,7 @@ spoe_acquire_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
 static void
 spoe_release_buffer(struct buffer *buf, struct buffer_wait *buffer_wait)
 {
-       if (LIST_INLIST(&buffer_wait->list))
-               LIST_DEL_INIT(&buffer_wait->list);
+       b_dequeue(buffer_wait);
 
        /* Release the buffer if needed */
        if (buf->size) {
index e8a71905456678ea7beda6826ee90553fcaa9ce7..7008a72493f860b38d05aefb5571f42a3e15f5fd 100644 (file)
@@ -753,8 +753,7 @@ static void fcgi_release(struct fcgi_conn *fconn)
 
        TRACE_POINT(FCGI_EV_FCONN_END);
 
-       if (LIST_INLIST(&fconn->buf_wait.list))
-               LIST_DEL_INIT(&fconn->buf_wait.list);
+       b_dequeue(&fconn->buf_wait);
 
        fcgi_release_buf(fconn, &fconn->dbuf);
        fcgi_release_mbuf(fconn);
index 4839e432eb93083a4f0f7161e7a18ad0dc81104d..dbd93a9b4fb6a048cd7ec9d08088c34f7b995e20 100644 (file)
@@ -1238,9 +1238,7 @@ static void h1_release(struct h1c *h1c)
        }
 
 
-       if (LIST_INLIST(&h1c->buf_wait.list))
-               LIST_DEL_INIT(&h1c->buf_wait.list);
-
+       b_dequeue(&h1c->buf_wait);
        h1_release_buf(h1c, &h1c->ibuf);
        h1_release_buf(h1c, &h1c->obuf);
 
index 9f2bef246c230e65bfc349eb33a35f146550d69a..82ed4cb14b3c1e4d9d9749e41ab221831bfc9399 100644 (file)
@@ -1193,8 +1193,7 @@ static void h2_release(struct h2c *h2c)
 
        hpack_dht_free(h2c->ddht);
 
-       if (LIST_INLIST(&h2c->buf_wait.list))
-               LIST_DEL_INIT(&h2c->buf_wait.list);
+       b_dequeue(&h2c->buf_wait);
 
        h2_release_buf(h2c, &h2c->dbuf);
        h2_release_mbuf(h2c);
index 6699585303ab6c8f881109f30cfa98c2e1eaa13d..a50294251f139cefc3f4f376abf82bbbc4328fd2 100644 (file)
@@ -632,8 +632,7 @@ void stream_free(struct stream *s)
        }
 
        /* We may still be present in the buffer wait queue */
-       if (LIST_INLIST(&s->buffer_wait.list))
-               LIST_DEL_INIT(&s->buffer_wait.list);
+       b_dequeue(&s->buffer_wait);
 
        if (s->req.buf.size || s->res.buf.size) {
                int count = !!s->req.buf.size + !!s->res.buf.size;