]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: simplify qc_send_hdshk_pkts() return
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 8 Apr 2024 13:25:56 +0000 (15:25 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 10 Apr 2024 08:14:36 +0000 (10:14 +0200)
Clean up trailer of qc_send_hdshk_pkts() by removing label "leave". Only
"out" label is now used. This operation is safe as LIST_DEL_INIT() is
idempotent. Caller of qc_send_hdshk_pkts() also ensures input frame
lists are freed, so it's better to always reset quic_enc_level
<retrans_frms> member.

Also take the opportunity to reset QUIC_FL_CONN_RETRANS_OLD_DATA only if
already set. This is considered more robust and will also remove
unneeded trace occurences.

No functional change. The main objective of this commit is to clean up
code in preparation of a refactoring on send functions.

src/quic_tx.c

index 94646a68d22ce1cb6d243a5f96f3666b8803e42b..356bc4a8187be80fb54a5bbede46a7e6556a4948 100644 (file)
@@ -911,7 +911,7 @@ int qc_send_hdshk_pkts(struct quic_conn *qc, int old_data,
 
        if (!buf) {
                TRACE_ERROR("buffer allocation failed", QUIC_EV_CONN_TXPKT, qc);
-               goto leave;
+               goto out;
        }
 
        if (b_data(buf) && !qc_purge_txbuf(qc, buf)) {
@@ -969,10 +969,12 @@ int qc_send_hdshk_pkts(struct quic_conn *qc, int old_data,
                qel2->retrans_frms = NULL;
        }
 
-       TRACE_STATE("no more need old data for probing", QUIC_EV_CONN_TXPKT, qc);
-       qc->flags &= ~QUIC_FL_CONN_RETRANS_OLD_DATA;
- leave:
-       TRACE_LEAVE(QUIC_EV_CONN_TXPKT, qc);
+       if (old_data) {
+               TRACE_STATE("no more need old data for probing", QUIC_EV_CONN_TXPKT, qc);
+               qc->flags &= ~QUIC_FL_CONN_RETRANS_OLD_DATA;
+       }
+
+       TRACE_DEVEL((status ? "leaving" : "leaving in error"), QUIC_EV_CONN_TXPKT, qc);
        return status;
 }