mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-05 21:16:09 +02:00
MINOR: mux-h2: simplify the exit code in h2_rcv_buf()
The code used to decide what to tell to the upper layer and when to free the rxbuf is a bit convoluted and difficult to adapt to dynamic rxbufs. We first need to deal with memory management (b_free) and only then to decide what to report upwards. Right now it does it the other way around. This should not change anything.
This commit is contained in:
parent
3b5ac2b553
commit
a0ed92f3dd
11
src/mux_h2.c
11
src/mux_h2.c
@ -7234,6 +7234,13 @@ static size_t h2_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count, in
|
||||
ret -= h2s_htx->data;
|
||||
|
||||
end:
|
||||
/* release the rxbuf if it's not used anymore */
|
||||
if (!b_data(&h2s->rxbuf) && b_size(&h2s->rxbuf)) {
|
||||
b_free(&h2s->rxbuf);
|
||||
offer_buffers(NULL, 1);
|
||||
}
|
||||
|
||||
/* tell the stream layer whether there are data left or not */
|
||||
if (b_data(&h2s->rxbuf))
|
||||
se_fl_set(h2s->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
|
||||
else {
|
||||
@ -7246,10 +7253,6 @@ static size_t h2_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count, in
|
||||
|
||||
se_fl_clr(h2s->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
|
||||
h2s_propagate_term_flags(h2c, h2s);
|
||||
if (b_size(&h2s->rxbuf)) {
|
||||
b_free(&h2s->rxbuf);
|
||||
offer_buffers(NULL, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (ret && h2c->dsi == h2s->id) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user