From: Willy Tarreau Date: Thu, 31 Jan 2019 09:31:51 +0000 (+0100) Subject: MINOR: mux-h2: make sure to only check concurrency limit on the frontend X-Git-Tag: v2.0-dev1~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa1d357f05872a4485677d6bb4c47b2942b8cd51;p=thirdparty%2Fhaproxy.git MINOR: mux-h2: make sure to only check concurrency limit on the frontend h2_has_too_many_cs() was renamed to h2_frt_has_too_many_cs() to make it clear it's only used to throttle the frontend connection, and the call places were adjusted to only call this code on a front connection. In practice it was already the case since the H2_CF_DEM_TOOMANY flag is only set there. But now the ambiguity is removed. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index a811c0a26f..648f0d2a3a 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -323,8 +323,8 @@ static inline void h2c_restart_reading(const struct h2c *h2c) } -/* returns true if the connection has too many conn_streams attached */ -static inline int h2_has_too_many_cs(const struct h2c *h2c) +/* returns true if the front connection has too many conn_streams attached */ +static inline int h2_frt_has_too_many_cs(const struct h2c *h2c) { return h2c->nb_cs > h2_settings_max_concurrent_streams; } @@ -952,7 +952,7 @@ static struct h2s *h2c_frt_stream_new(struct h2c *h2c, int id) sess->t_handshake = 0; /* OK done, the stream lives its own life now */ - if (h2_has_too_many_cs(h2c)) + if (h2_frt_has_too_many_cs(h2c)) h2c->flags |= H2_CF_DEM_TOOMANY; return h2s; @@ -2936,8 +2936,9 @@ static void h2_detach(struct conn_stream *cs) h2c = h2s->h2c; h2s->cs = NULL; h2c->nb_cs--; - if (h2c->flags & H2_CF_DEM_TOOMANY && - !h2_has_too_many_cs(h2c)) { + if ((h2c->flags & (H2_CF_IS_BACK|H2_CF_DEM_TOOMANY)) == H2_CF_DEM_TOOMANY && + !h2_frt_has_too_many_cs(h2c)) { + /* frontend connection was blocking new streams creation */ h2c->flags &= ~H2_CF_DEM_TOOMANY; h2c_restart_reading(h2c); }