mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 16:17:09 +02:00
MINOR: h2: update the {MUX,DEM}_{M,D}ALLOC flags on buffer availability
Flag H2_CF_DEM_DALLOC is set when the demux buffer fails to be allocated in the recv() callback, and is cleared when it succeeds. Both flags H2_CF_MUX_MALLOC and H2_CF_DEM_MROOM are cleared when the mux buffer allocation succeeds. In both cases it will be up to the callers to report allocation failures.
This commit is contained in:
parent
3ccf4b2a20
commit
1b62c5caef
19
src/mux_h2.c
19
src/mux_h2.c
@ -191,6 +191,8 @@ static int h2_dbuf_available(void *target)
|
|||||||
|
|
||||||
/* take the buffer now as we'll get scheduled waiting for ->wake() */
|
/* take the buffer now as we'll get scheduled waiting for ->wake() */
|
||||||
if (b_alloc_margin(&h2c->dbuf, 0)) {
|
if (b_alloc_margin(&h2c->dbuf, 0)) {
|
||||||
|
h2c->flags &= ~H2_CF_DEM_DALLOC;
|
||||||
|
if (!(h2c->flags & H2_CF_DEM_BLOCK_ANY))
|
||||||
conn_xprt_want_recv(h2c->conn);
|
conn_xprt_want_recv(h2c->conn);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -232,11 +234,22 @@ static int h2_mbuf_available(void *target)
|
|||||||
|
|
||||||
/* take the buffer now as we'll get scheduled waiting for ->wake(). */
|
/* take the buffer now as we'll get scheduled waiting for ->wake(). */
|
||||||
if (b_alloc_margin(&h2c->mbuf, 0)) {
|
if (b_alloc_margin(&h2c->mbuf, 0)) {
|
||||||
|
if (h2c->flags & H2_CF_MUX_MALLOC) {
|
||||||
|
h2c->flags &= ~H2_CF_MUX_MALLOC;
|
||||||
|
if (!(h2c->flags & H2_CF_MUX_BLOCK_ANY))
|
||||||
|
conn_xprt_want_send(h2c->conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (h2c->flags & H2_CF_DEM_MROOM) {
|
||||||
|
h2c->flags &= ~H2_CF_DEM_MROOM;
|
||||||
|
if (!(h2c->flags & H2_CF_DEM_BLOCK_ANY))
|
||||||
|
conn_xprt_want_recv(h2c->conn);
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: we should in fact call something like h2_update_poll()
|
/* FIXME: we should in fact call something like h2_update_poll()
|
||||||
* now to recompte the polling. For now it will be enough like
|
* now to recompte the polling. For now it will be enough like
|
||||||
* this.
|
* this.
|
||||||
*/
|
*/
|
||||||
conn_xprt_want_recv(h2c->conn);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -579,8 +592,10 @@ static void h2_recv(struct connection *conn)
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
buf = h2_get_dbuf(h2c);
|
buf = h2_get_dbuf(h2c);
|
||||||
if (!buf)
|
if (!buf) {
|
||||||
|
h2c->flags |= H2_CF_DEM_DALLOC;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* note: buf->o == 0 */
|
/* note: buf->o == 0 */
|
||||||
max = buf->size - buf->i;
|
max = buf->size - buf->i;
|
||||||
|
Loading…
Reference in New Issue
Block a user