]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: Process next request for IDLE connection only
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 5 Oct 2020 15:14:28 +0000 (17:14 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Dec 2020 13:41:49 +0000 (14:41 +0100)
When the conn-stream is detached for a H1 connection, there is no reason to
subscribe for reads or process pending input data if the connection is not
idle. Because, it means a shutdown is pending.

src/mux_h1.c

index 50d148bb7487c628340edf7ea535f1e87e697e3b..4a518accb5b8cd487df05763d0f66d34d907ac51 100644 (file)
@@ -2538,11 +2538,15 @@ static void h1_detach(struct conn_stream *cs)
                h1_release(h1c);
        }
        else {
-               /* If we have a new request, process it immediately */
-               if (unlikely(b_data(&h1c->ibuf)))
-                       h1_process(h1c);
-               else
-                       h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event);
+               if (h1c->flags & H1C_F_CS_IDLE) {
+                       /* If we have a new request, process it immediately or
+                        * subscribe for reads waiting for new data
+                        */
+                       if (unlikely(b_data(&h1c->ibuf)))
+                               h1_process(h1c);
+                       else
+                               h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event);
+               }
                h1_refresh_timeout(h1c);
        }
   end: