]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream: Handle appctx case first when creating a new stream
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 15 Dec 2021 10:42:23 +0000 (11:42 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 24 Feb 2022 10:00:01 +0000 (11:00 +0100)
In the same way the previous commit, when a stream is created, the appctx
case is now handled before the conn-stream one. The purpose of this change
is to limit bugs during the SI/CS refactoring.

src/stream.c

index 98e34a993b6f311611548d09c5a78789c8ac17e3..1b554cb49aafdb1a2d287cef7ffcc3197d9f92d3 100644 (file)
@@ -460,24 +460,26 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin, struct bu
        si_set_state(&s->si[0], SI_ST_EST);
        s->si[0].hcto = sess->fe->timeout.clientfin;
 
-       if (cs_conn(cs) && cs->conn->mux) {
-               if (cs->conn->mux->flags & MX_FL_CLEAN_ABRT)
-                       s->si[0].flags |= SI_FL_CLEAN_ABRT;
-               if (cs->conn->mux->flags & MX_FL_HTX)
-                       s->flags |= SF_HTX;
-
-               if (cs->flags & CS_FL_WEBSOCKET)
-                       s->flags |= SF_WEBSOCKET;
-       }
         /* Set SF_HTX flag for HTTP frontends. */
        if (sess->fe->mode == PR_MODE_HTTP)
                s->flags |= SF_HTX;
 
-       /* attach the incoming connection to the stream interface now. */
-       if (cs)
-               si_attach_cs(&s->si[0], cs);
-       else if (appctx)
+       if (appctx)
                si_attach_appctx(&s->si[0], appctx);
+       else if (cs) {
+               if (cs_conn(cs) && cs->conn->mux) {
+                       if (cs->conn->mux->flags & MX_FL_CLEAN_ABRT)
+                               s->si[0].flags |= SI_FL_CLEAN_ABRT;
+                       if (cs->conn->mux->flags & MX_FL_HTX)
+                               s->flags |= SF_HTX;
+
+                       if (cs->flags & CS_FL_WEBSOCKET)
+                               s->flags |= SF_WEBSOCKET;
+               }
+               /* attach the incoming connection to the stream interface now. */
+               si_attach_cs(&s->si[0], cs);
+       }
+
 
        if (likely(sess->fe->options2 & PR_O2_INDEPSTR))
                s->si[0].flags |= SI_FL_INDEP_STR;