]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: delete timer task on quic_close()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Dec 2021 14:06:56 +0000 (15:06 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Dec 2021 15:06:07 +0000 (16:06 +0100)
The timer task is attached to the connection-pinned thread. Only this
thread can delete it. With the future refcount implementation of
quic_conn, every thread can be responsible to remove the quic_conn via
quic_conn_free(). Thus, the timer task deletion is moved from the
calling function quic_close().

src/xprt_quic.c

index 05f87a546fd21c3f0ab37156e99a4c873dd2570b..4fd7d9f6949797212ffc887f93266a41e8a189de 100644 (file)
@@ -637,7 +637,7 @@ static inline void qc_set_timer(struct quic_conn *qc)
        if (tick_isset(pto))
                qc->timer = pto;
  out:
-       if (qc->timer != TICK_ETERNITY)
+       if (qc->timer_task && qc->timer != TICK_ETERNITY)
                task_schedule(qc->timer_task, qc->timer);
        TRACE_LEAVE(QUIC_EV_CONN_STIMER, qc, pktns);
 }
@@ -3213,8 +3213,7 @@ static void quic_conn_free(struct quic_conn *qc)
 
        for (i = 0; i < QUIC_TLS_ENC_LEVEL_MAX; i++)
                quic_conn_enc_level_uninit(&qc->els[i]);
-       if (qc->timer_task)
-               task_destroy(qc->timer_task);
+
        pool_free(pool_head_quic_conn_rxbuf, qc->rx.buf.area);
        pool_free(pool_head_quic_conn, qc);
 }
@@ -3223,6 +3222,13 @@ void quic_close(struct connection *conn, void *xprt_ctx)
 {
        struct ssl_sock_ctx *conn_ctx = xprt_ctx;
        struct quic_conn *qc = conn_ctx->conn->qc;
+
+       /* This task must be deleted by the connection-pinned thread. */
+       if (qc->timer_task) {
+               task_destroy(qc->timer_task);
+               qc->timer_task = NULL;
+       }
+
        quic_conn_free(qc);
 }