]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream: Rely on stconn flags to abort stream destructive upgrade
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 17 Jun 2022 07:36:57 +0000 (09:36 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 17 Jun 2022 11:25:02 +0000 (13:25 +0200)
On destructive connection upgrade, instead of using the new mux name to
abort the old stream, we can relay on the stream connector flags. If it is
detached after the upgrade, it means the stream will not be resused by the
new mux and it must be aborted.

This patch may be backported to 2.6.

src/stream.c

index 2f698482f3106d9b08511e8ee5a8674e66a9c589..5de7cdda71c1c3889345e314a83b04bad0e472d4 100644 (file)
@@ -1498,11 +1498,12 @@ int stream_set_http_mode(struct stream *s, const struct mux_proto_list *mux_prot
                s->req.flags &= ~(CF_READ_PARTIAL|CF_AUTO_CONNECT);
                s->req.total = 0;
                s->flags |= SF_IGNORE;
-               if (strcmp(conn->mux->name, "H2") == 0) {
-                       /* For HTTP/2, destroy the stream connector, disable logging,
-                        * and abort the stream process. Thus it will be
-                        * silently destroyed. The new mux will create new
-                        * streams.
+               if (sc_ep_test(sc, SE_FL_DETACHED)) {
+                       /* If stream connector is detached, it means it was not
+                        * reused by the new mux. Son destroy it, disable
+                        * logging, and abort the stream process. Thus the
+                        * stream will be silently destroyed. The new mux will
+                        * create new streams.
                         */
                        s->logs.logwait = 0;
                        s->logs.level = 0;