MEDIUM: dynbuf: generalize the use of b_dequeue() to detach buffer_wait

Now thanks to this the bufq_map field is expected to remain accurate.
This commit is contained in:
Willy Tarreau 2024-04-24 18:44:03 +02:00
parent f70bd5fad1
commit f5566afec6
8 changed files with 9 additions and 19 deletions

View 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));

View 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);
}

View 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);

View 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) {

View 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);

View 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);

View 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);

View 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;