]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Initialize the connection timer asap
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 31 Jan 2022 09:16:18 +0000 (10:16 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 31 Jan 2022 15:40:23 +0000 (16:40 +0100)
We must move this initialization from xprt_start() callback, which
comes too late (after handshake completion for 1RTT session). This timer must be
usable as soon as we have packets to send/receive. Let's initialize it after
the TLS context is initialized in qc_conn_alloc_ssl_ctx(). This latter function
initializes I/O handler task (quic_conn_io_cb) to send/receive packets.

src/xprt_quic.c

index 6537f04973d1069d627f14e836ee1114daadde53..ef4464d04d9235df78ff2ca6e5f192b3605c754a 100644 (file)
@@ -4361,6 +4361,9 @@ static ssize_t qc_lstnr_pkt_rcv(unsigned char *buf, const unsigned char *end,
                        if (qc_conn_alloc_ssl_ctx(qc))
                                goto err;
 
+                       if (!quic_conn_init_timer(qc))
+                               goto err;
+
                        /* NOTE: the socket address has been concatenated to the destination ID
                         * chosen by the client for Initial packets.
                         */
@@ -5317,11 +5320,6 @@ static int qc_xprt_start(struct connection *conn, void *ctx)
        struct ssl_sock_ctx *qctx = ctx;
 
        qc = conn->qc;
-       if (!quic_conn_init_timer(qc)) {
-               TRACE_PROTO("Non initialized timer", QUIC_EV_CONN_LPKT, qc);
-               return 0;
-       }
-
        quic_mux_transport_params_update(qc->qcc);
        if (qcc_install_app_ops(qc->qcc, qc->app_ops)) {
                TRACE_PROTO("Cannot install app layer", QUIC_EV_CONN_LPKT, qc);