From: Amaury Denoyelle Date: Fri, 27 Sep 2024 13:31:21 +0000 (+0200) Subject: MINOR: quic: remove unneeded notification of txbuf room X-Git-Tag: v3.1-dev9~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4859d8e71d9ccefcb64a474871c9a537872af646;p=thirdparty%2Fhaproxy.git MINOR: quic: remove unneeded notification of txbuf room When a stream buffer is freed, qc_stream_desc notify MUX. This is useful if MUX is waiting for Tx buffer allocation. Remove this notification in qc_stream_desc(). This is because the function is called when all stream data have been acknowledged and thus notified. This function can also be called with some data unacknowledged, but in this case this is only true just before connection closure. As such, it is useful to notify the MUX in this condition. --- diff --git a/src/quic_stream.c b/src/quic_stream.c index 7181e00346..91f657d476 100644 --- a/src/quic_stream.c +++ b/src/quic_stream.c @@ -209,36 +209,32 @@ void qc_stream_desc_free(struct qc_stream_desc *stream, int closing) struct quic_conn *qc = stream->qc; struct eb64_node *frm_node; unsigned int free_count = 0; - uint64_t free_size = 0; /* This function only deals with released streams. */ BUG_ON(!(stream->flags & QC_SD_FL_RELEASE)); /* free remaining stream buffers */ list_for_each_entry_safe(buf, buf_back, &stream->buf_list, list) { - if (!(b_data(&buf->buf)) || closing) { - free_size += b_size(&buf->buf); - if (buf->sbuf) - pool_free(pool_head_sbuf, buf->buf.area); - else - b_free(&buf->buf); - LIST_DELETE(&buf->list); - pool_free(pool_head_quic_stream_buf, buf); - ++free_count; - } - } - if (free_count) { - offer_buffers(NULL, free_count); + /* qc_stream_desc_free() can only be used after all data is + * acknowledged or on connection shutdown. In the contrary + * case, MUX must be notified about room available. + */ + BUG_ON(b_data(&buf->buf) && !closing); - if (qc->mux_state == QC_MUX_READY) { - if (!(stream->flags & QC_SD_FL_OOB_BUF)) { - /* notify MUX about available buffers. */ - qcc_notify_buf(qc->qcc, free_size); - } - } + if (buf->sbuf) + pool_free(pool_head_sbuf, buf->buf.area); + else + b_free(&buf->buf); + + LIST_DELETE(&buf->list); + pool_free(pool_head_quic_stream_buf, buf); + ++free_count; } + if (free_count) + offer_buffers(NULL, free_count); + /* qc_stream_desc might be freed before having received all its ACKs. * This is the case if some frames were retransmitted. */