]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: quic: rename confusing qc_purge_txbuf() to qc_flush_txbuf()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 8 Oct 2026 13:55:27 +0000 (15:55 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 16 Oct 2026 08:01:41 +0000 (10:01 +0200)
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.

include/haproxy/quic_tx.h
src/quic_tx.c

index 4f58c21db50d4eedac8ea32c0092aa1ed6738723..5ad59f18991d7fd0c84099986867123bb090c231 100644 (file)
@@ -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,
index 696b337c3d0e668a71b3a0dd6ec084aea6eb3881..eeb9d5e83ea997062577c1d5955bbdefc3fef43b 100644 (file)
@@ -480,14 +480,13 @@ leave:
        return ret;
 }
 
-/* Flush txbuf for <qc> 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 <qc> 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;
        }