]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: backend: add new conn to session if mux marked as HOL blocking
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 14 Oct 2020 16:17:08 +0000 (18:17 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 15 Oct 2020 13:19:34 +0000 (15:19 +0200)
When allocating a new session on connect_server, if the mux protocol is
marked as subject of HOL blocking, add it into session instead of
available list to avoid sharing it with other clients.

src/backend.c

index bd841c20a9339fc7bfef984bac14b04d8fd4a695..48cc7a661a7f9dee4206aea7fdded78ac7ee7bfc 100644 (file)
@@ -1540,13 +1540,16 @@ int connect_server(struct stream *s)
                /* If we're doing http-reuse always, and the connection is not
                 * private with available streams (an http2 connection), add it
                 * to the available list, so that others can use it right
-                * away. If the connection is private, add it in the session
-                * server list.
+                * away. If the connection is private or we're doing http-reuse
+                * safe and the mux protocol supports multiplexing, add it in
+                * the session server list.
                 */
                if (srv && ((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_ALWS) &&
                    !(srv_conn->flags & CO_FL_PRIVATE) && srv_conn->mux->avail_streams(srv_conn) > 0)
                        LIST_ADDQ(&srv->available_conns[tid], mt_list_to_list(&srv_conn->list));
-               else if (srv_conn->flags & CO_FL_PRIVATE) {
+               else if (srv_conn->flags & CO_FL_PRIVATE ||
+                        ((s->be->options & PR_O_REUSE_MASK) == PR_O_REUSE_SAFE &&
+                         srv_conn->mux->flags & MX_FL_HOL_RISK)) {
                        /* If it fail now, the same will be done in mux->detach() callback */
                        session_add_conn(srv_conn->owner, srv_conn, srv_conn->target);
                }