From efc6e95642c3546d05136b3d4712e59e042c34a8 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Wed, 5 May 2021 11:11:11 +0200 Subject: [PATCH] MEDIUM: mux_h1: release idling frontend conns on soft-stop 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mux_h1.c b/src/mux_h1.c index e8a7d6b..940b754 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -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); -- 1.7.10.4