MEDIUM: stream-int: always mark pending outgoing SI_ST_CON
Before the first send() attempt, we should be in SI_ST_CON, not
SI_ST_EST, since we have not yet attempted to send and we are
allowed to retry. This is particularly important with complex
outgoing muxes which can fail during the first send attempt (e.g.
failed stream ID allocation).
It only requires that sess_update_st_con_tcp() knows about this
possibility, as we must not forcefully close a reused connection
when facing an error in this case, this will be handled later.
This may be backported to 1.9 with care after some observation period.
diff --git a/src/stream.c b/src/stream.c
index ade70bc..c0f4b07 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -626,10 +626,7 @@
struct channel *req = &s->req;
struct channel *rep = &s->res;
struct conn_stream *srv_cs = objt_cs(si->end);
- struct connection *conn = NULL;
-
- if (!srv_cs)
- conn = objt_conn(si->end);
+ struct connection *conn = srv_cs ? srv_cs->conn : objt_conn(si->end);
/* If we got an error, or if nothing happened and the connection timed
* out, we must give up. The CER state handler will take care of retry
@@ -649,9 +646,7 @@
si->exp = TICK_ETERNITY;
si->state = SI_ST_CER;
- if (srv_cs)
- conn = srv_cs->conn;
- if (conn) {
+ if (!(s->flags & SF_SRV_REUSED) && conn) {
conn_stop_tracking(conn);
conn_full_close(conn);
}