MINOR: mux-quic: do not allocate Tx buf for empty STREAM frame
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 26 Apr 2023 09:38:11 +0000 (11:38 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 26 Apr 2023 15:50:16 +0000 (17:50 +0200)
commita57ab0fabe7aae9a67d03f3a1e87052cdef32efd
treecbb8748d2adde37a0cb9fc75a0b4f1cdb75393bb
parent42c5b75cac88401bd02157588643285796e2af8a
MINOR: mux-quic: do not allocate Tx buf for empty STREAM frame

Sometimes it may be necessary to send an empty STREAM frame to signal
clean stream closure with FIN bit set. Prior to this change, a Tx buffer
was allocated unconditionnally even if no data is transferred.

Most of the times, allocation was not performed due to an older buffer
reused. But if data were already acknowledge, a new buffer is allocated.
No memory leak occurs as the buffer is properly released when the empty
frame acknowledge is received. But this allocation is unnecessary and it
consumes a connexion Tx buffer for nothing.

Improve this by skipping buffer allocation if no data to transfer.
qcs_build_stream_frm() is now able to deal with a NULL out argument.

This should be backported up to 2.6.
src/mux_quic.c