MINOR: stream: Handle appctx case first when creating a new stream

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.
This commit is contained in:
Christopher Faulet 2021-12-15 11:42:23 +01:00
parent 0256da14a5
commit a742293ec9

View 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;