mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: quic: ensure txbuf realloc is only performed on empty buffer
QUIC application protocol layer has the ability to either allocate a standard buffer or a smaller one. The latter is useful when only small data are transferred to prevent consuming too much of the QUIC MUX buffer window. This operation is performed using qc_stream_buf_realloc(). Add a new BUG_ON() in it to ensure no data is present in the buffer. Indeed, this would cause to data loss, or even crash when trying to acknowledge data. Note that for the moment qc_stream_buf_realloc() is only use for HTTP/3 headers transmission, and this usage is conform to the new BUG_ON. This commit is thus not a bug fix, but only to strengthen the API.
This commit is contained in:
parent
172404a8ec
commit
fdc16c1e01
@ -325,6 +325,9 @@ struct buffer *qc_stream_buf_realloc(struct qc_stream_desc *stream)
|
||||
/* This function is reserved to convert a big buffer to a smaller one. */
|
||||
BUG_ON(!stream->buf || !stream->buf->sbuf);
|
||||
|
||||
/* This function can only be used if targetted buffer is empty. */
|
||||
BUG_ON(b_data(&stream->buf->buf));
|
||||
|
||||
/* Release buffer */
|
||||
pool_free(pool_head_sbuf, stream->buf->buf.area);
|
||||
stream->buf->buf = BUF_NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user