From: Amaury Denoyelle Date: Thu, 8 Oct 2026 13:55:27 +0000 (+0200) Subject: MINOR: quic: rename confusing qc_purge_txbuf() to qc_flush_txbuf() X-Git-Tag: v3.5-dev10~177 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=73ebe0b3b4458767aaa4fe03dc99c1309f2daf04;p=haproxy.git MINOR: quic: rename confusing qc_purge_txbuf() to qc_flush_txbuf() Function qc_purge_txbuf() naming is confusing as it may imply that prepared data are simply discarded. In fact, the objective of this function is to first send all of its content before clearing it. This names also conflicts with qc_purge_tx_buf() (note the extra underscore) which reset the buffer. Thus, renaming the first one is better to prevent any confusion. --- diff --git a/include/haproxy/quic_tx.h b/include/haproxy/quic_tx.h index 4f58c21db..5ad59f189 100644 --- a/include/haproxy/quic_tx.h +++ b/include/haproxy/quic_tx.h @@ -32,7 +32,6 @@ struct buffer *qc_txb_alloc(struct quic_conn *qc); void qc_txb_release(struct quic_conn *qc); -int qc_purge_txbuf(struct quic_conn *qc, struct buffer *buf); struct buffer *qc_get_txb(struct quic_conn *qc); enum quic_tx_err qc_send_mux(struct quic_conn *qc, struct list *frms, diff --git a/src/quic_tx.c b/src/quic_tx.c index 696b337c3..eeb9d5e83 100644 --- a/src/quic_tx.c +++ b/src/quic_tx.c @@ -480,14 +480,13 @@ leave: return ret; } -/* Flush txbuf for connection. This must be called prior to a packet - * preparation when txbuf contains older data. A send will be conducted for - * these data. +/* Flush txbuf for connection. Useful to retry emission on already + * prepared datagrams after a transient error. * - * Returns 1 on success : buffer is empty and can be use for packet - * preparation. On error 0 is returned. + * Returns 1 on success, everything sent and buffer now empty. Value 0 is used + * if emission failed and buffer still contains some data. */ -int qc_purge_txbuf(struct quic_conn *qc, struct buffer *buf) +static int qc_flush_txbuf(struct quic_conn *qc, struct buffer *buf) { TRACE_ENTER(QUIC_EV_CONN_TXPKT, qc); @@ -908,8 +907,8 @@ int qc_send(struct quic_conn *qc, int old_data, struct list *send_list, goto out; } - if (b_data(buf) && !qc_purge_txbuf(qc, buf)) { - TRACE_ERROR("Could not purge TX buffer", QUIC_EV_CONN_TXPKT, qc); + if (b_data(buf) && !qc_flush_txbuf(qc, buf)) { + TRACE_ERROR("Could not flush TX buffer", QUIC_EV_CONN_TXPKT, qc); ret = -1; goto out; }