]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add useful debugging traces in qc_idle_timer_do_rearm()
authorFrederic Lecaille <flecaille@haproxy.com>
Fri, 28 Nov 2025 10:54:23 +0000 (11:54 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Mon, 8 Dec 2025 09:40:59 +0000 (10:40 +0100)
Traces were missing in this function.
Also add information about the connection struct from qc->conn when
initialized for all the traces.

Should be easily backported as far as 2.6.

src/quic_conn.c
src/quic_trace.c

index 7ae359918f99a88489ea0520dbcf469d761e12f2..38f2208d9ec941361268916aa293d076e627fa4b 100644 (file)
@@ -1721,9 +1721,13 @@ void qc_idle_timer_do_rearm(struct quic_conn *qc, int arm_ack)
 {
        unsigned int expire;
 
+       TRACE_ENTER(QUIC_EV_CONN_IDLE_TIMER, qc);
+
        /* It is possible the idle timer task has been already released. */
-       if (!qc->idle_timer_task)
-               return;
+       if (!qc->idle_timer_task) {
+               TRACE_PROTO("idle timer already released", QUIC_EV_CONN_IDLE_TIMER, qc);
+               goto leave;
+       }
 
        if (qc->flags & (QUIC_FL_CONN_CLOSING|QUIC_FL_CONN_DRAINING)) {
                /* RFC 9000 10.2. Immediate Close
@@ -1752,6 +1756,8 @@ void qc_idle_timer_do_rearm(struct quic_conn *qc, int arm_ack)
                expire = QUIC_MAX(3 * quic_pto(qc), qc->max_idle_timeout);
        }
 
+       TRACE_PRINTF(TRACE_LEVEL_PROTO, QUIC_EV_CONN_IDLE_TIMER, qc, 0, 0, 0,
+                    "quic_pto=%u expire=%u", quic_pto(qc), expire);
        qc->idle_expire = tick_add(now_ms, MS_TO_TICKS(expire));
        /* Note that the ACK timer is not armed during the handshake. So,
         * the handshake expiration date is taken into an account only
@@ -1773,6 +1779,9 @@ void qc_idle_timer_do_rearm(struct quic_conn *qc, int arm_ack)
                task_queue(qc->idle_timer_task);
                TRACE_PROTO("idle timer armed", QUIC_EV_CONN_IDLE_TIMER, qc);
        }
+
+ leave:
+       TRACE_LEAVE(QUIC_EV_CONN_IDLE_TIMER, qc);
 }
 
 /* Rearm the idle timer or ack timer for <qc> QUIC connection depending on <read>
index a19e65b37f83ec278fb8786bab37c551e00a3595..6911893f551ffe01f199235d0bb796ad90531e79 100644 (file)
@@ -119,6 +119,9 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
                chunk_appendf(&trace_buf, " : qc@%p(%c) idle_timer_task@%p flags=0x%x",
                              qc, (qc->flags & QUIC_FL_CONN_IS_BACK) ? 'B' : 'F',
                              qc->idle_timer_task, qc->flags);
+               if (qc->conn)
+                       chunk_appendf(&trace_buf, " conn@%p(err_code=%d flags=0x%llx)",
+                             qc->conn, qc->conn->err_code, (ull)qc->conn->flags);
                if (mask & QUIC_EV_CONN_NEW) {
                        const int *ssl_err = a2;