]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mux_h1: release idling frontend conns on soft-stop
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 5 May 2021 09:11:11 +0000 (11:11 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 5 May 2021 12:35:36 +0000 (14:35 +0200)
In h1_process, if the proxy of a frontend connection is disabled,
release the connection.

This commit is in preparation to properly close idling front connections
on soft-stop. h1_process must still be called, this will be done via a
dedicated task which monitors the global variable stopping.

src/mux_h1.c

index e8a7d6b7a390f58a815d5b7d0ec5d2fece13cb1f..940b7540cb5c7e2fbaa37aed02905fe9efc0a2c1 100644 (file)
@@ -2769,6 +2769,15 @@ static int h1_process(struct h1c * h1c)
        if (!b_data(&h1c->ibuf))
                h1_release_buf(h1c, &h1c->ibuf);
 
+       /* Check if a soft-stop is in progress.
+        * Release idling front connection if this is the case.
+        */
+       if (!(h1c->flags & H1C_F_IS_BACK)) {
+               if (unlikely(h1c->px->disabled)) {
+                       if (h1c->flags & H1C_F_WAIT_NEXT_REQ)
+                               goto release;
+               }
+       }
 
        if ((h1c->flags & H1C_F_WANT_SPLICE) && !h1s_data_pending(h1s)) {
                TRACE_DEVEL("xprt rcv_buf blocked (want_splice), notify h1s for recv", H1_EV_H1C_RECV, h1c->conn);