]> git.kaiwu.me - haproxy.git/commitdiff
CLEANUP: quic: remove the dead encryption level variable in qc_prep_hdshk_fast_retrans()
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 4 Nov 2026 16:55:02 +0000 (17:55 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Thu, 5 Nov 2026 08:58:36 +0000 (09:58 +0100)
<qel> was assigned once to qc->iel and never modified afterwards, so
every "qel == iqel" test was always true. Use <iqel> directly for the
packet number space and for the pto_probe increment, test the
anti-amplification condition positively, and unwrap the requeue
condition.

The <start> label has had no goto target since this function stopped
looping over encryption levels, remove it.

No functional change, no need to backport.

src/quic_retransmit.c

index 7082984dde4bf98f1b36a46eac010181a316e0ec..93d9ae614159bf011a78de457d2c44b189f83818 100644 (file)
@@ -209,16 +209,15 @@ void qc_prep_hdshk_fast_retrans(struct quic_conn *qc,
 
        struct quic_enc_level *iqel = qc->iel;
        struct quic_enc_level *hqel = qc->hel;
-       struct quic_enc_level *qel = iqel;
        struct eb_root *pkts;
        struct eb64_node *node;
        struct quic_tx_packet *pkt;
        struct list *tmp = &itmp;
 
        TRACE_ENTER(QUIC_EV_CONN_SPPKTS, qc);
- start:
+
        pkt = NULL;
-       pkts = &qel->pktns->tx.pkts;
+       pkts = &iqel->pktns->tx.pkts;
        node = eb64_first(pkts);
        /* Skip the empty packet (they have already been retransmitted) */
        while (node) {
@@ -258,27 +257,24 @@ void qc_prep_hdshk_fast_retrans(struct quic_conn *qc,
                         * with a PING frame if a full-size datagram fits in what
                         * the anti-amplification limit allows to send.
                         */
-                       if (qel == iqel && may_send >= QUIC_INITIAL_PACKET_MINLEN)
-                               TRACE_PROTO("will probe Initial packet number space", QUIC_EV_CONN_SPPKTS, qc);
-                       else
+                       if (may_send < QUIC_INITIAL_PACKET_MINLEN)
                                goto end;
+                       TRACE_PROTO("will probe Initial packet number space", QUIC_EV_CONN_SPPKTS, qc);
                }
        }
 
-       qel->pktns->tx.pto_probe += 1;
+       iqel->pktns->tx.pto_probe++;
 
        /* No risk to loop here, #packets per datagram is bounded */
  requeue:
        TRACE_PROTO("duplicating packet", QUIC_EV_CONN_PRSAFRM, qc, NULL, &pkt->pn_node.key);
        qc_dup_pkt_frms(qc, &pkt->frms, tmp);
-       if (qel == iqel) {
-               if (pkt->next && pkt->next->type == QUIC_PACKET_TYPE_HANDSHAKE) {
-                       pkt = pkt->next;
-                       tmp = &htmp;
-                       hqel->pktns->tx.pto_probe += 1;
-                       TRACE_DEVEL("looping for next packet", QUIC_EV_CONN_SPPKTS, qc);
-                       goto requeue;
-               }
+       if (pkt->next && pkt->next->type == QUIC_PACKET_TYPE_HANDSHAKE) {
+               pkt = pkt->next;
+               tmp = &htmp;
+               hqel->pktns->tx.pto_probe++;
+               TRACE_DEVEL("looping for next packet", QUIC_EV_CONN_SPPKTS, qc);
+               goto requeue;
        }
 
  end: