]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mux-quic: delay the closing with the timeout
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 1 Feb 2022 09:33:09 +0000 (10:33 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 1 Feb 2022 14:19:35 +0000 (15:19 +0100)
Do not close immediatly the connection if there is no bidirectional
stream opened. Schedule instead the mux timeout when this condition is
verified. On the timer expiration, the mux/connection can be freed.

src/mux_quic.c

index 532304f311894eb65105a7ce497273459bb72cbb..7cd1231717a352d817b83b30045b3acca01c3f65 100644 (file)
@@ -391,9 +391,10 @@ static struct task *qc_io_cb(struct task *t, void *ctx, unsigned int status)
        qc_send(qcc);
 
        if (qc_release_detached_streams(qcc)) {
-               if (qcc_is_dead(qcc)) {
-                       qc_release(qcc);
-                       return NULL;
+               /* Schedule the mux timeout if no bidirectional streams left. */
+               if (qcc_may_expire(qcc)) {
+                       qcc->task->expire = tick_add(now_ms, qcc->timeout);
+                       task_queue(qcc->task);
                }
        }
 
@@ -530,9 +531,11 @@ static void qc_detach(struct conn_stream *cs)
        }
 
        qcs_destroy(qcs);
-       if (qcc_is_dead(qcc)) {
-               qc_release(qcc);
-               return;
+
+       /* Schedule the mux timeout if no bidirectional streams left. */
+       if (qcc_may_expire(qcc)) {
+               qcc->task->expire = tick_add(now_ms, qcc->timeout);
+               task_queue(qcc->task);
        }
 }