mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: mux-h2/htx: Support zero-copy when possible in h2_rcv_buf()
If the channel's buffer is empty and the message is small enough, we can swap the H2S buffer with the channel one.
This commit is contained in:
parent
9b04d22945
commit
2f6edc84a8
@ -5395,6 +5395,15 @@ static size_t h2_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
|
||||
ret = h2s_htx->data;
|
||||
buf_htx = htx_from_buf(buf);
|
||||
|
||||
/* <buf> is empty and the message is small enough, swap the
|
||||
* buffers. */
|
||||
if (htx_is_empty(buf_htx) && htx_used_space(h2s_htx) <= count) {
|
||||
htx_to_buf(buf_htx, buf);
|
||||
htx_to_buf(h2s_htx, &h2s->rxbuf);
|
||||
b_xfer(buf, &h2s->rxbuf, b_data(&h2s->rxbuf));
|
||||
goto end;
|
||||
}
|
||||
|
||||
htx_xfer_blks(buf_htx, h2s_htx, count, HTX_BLK_EOM);
|
||||
|
||||
if (h2s_htx->flags & HTX_FL_PARSING_ERROR)
|
||||
|
Loading…
Reference in New Issue
Block a user