CLEANUP: backend: invert the condition to start the mux in connect_server()

Instead of trying to switch from delayed start to instant start based
on a single condition, let's do the opposite and preset the condition
to instant start and detect what could cause it to be delayed, thus
falling back to the slow mode. The condition remains exactly the
inverted one and better matches the comment about ALPN being the only
cause of such a delay.
This commit is contained in:
Willy Tarreau 2025-08-07 16:30:38 +02:00 committed by Olivier Houchard
parent 7b4a7f92b5
commit 4aaf0bfbce

View File

@ -1793,7 +1793,7 @@ int connect_server(struct stream *s)
struct server *srv; struct server *srv;
int reuse_mode; int reuse_mode;
int reuse __maybe_unused = 0; int reuse __maybe_unused = 0;
int may_start_mux_now = 0; // are we allowed to start the mux now ? int may_start_mux_now = 1; // are we allowed to start the mux now ?
int err; int err;
struct sockaddr_storage *bind_addr = NULL; struct sockaddr_storage *bind_addr = NULL;
int64_t hash = 0; int64_t hash = 0;
@ -1841,6 +1841,7 @@ int connect_server(struct stream *s)
if (err == SF_ERR_NONE) { if (err == SF_ERR_NONE) {
srv_conn = sc_conn(s->scb); srv_conn = sc_conn(s->scb);
reuse = 1; reuse = 1;
may_start_mux_now = 0;
} }
} }
@ -2025,11 +2026,10 @@ int connect_server(struct stream *s)
* that this is skipped in TCP mode as we only want mux-pt * that this is skipped in TCP mode as we only want mux-pt
* anyway. * anyway.
*/ */
if (!srv || if (IS_HTX_STRM(s) && srv && srv->use_ssl &&
(srv->use_ssl != 1 || (!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || (srv->ssl_ctx.alpn_str || srv->ssl_ctx.npn_str))
!IS_HTX_STRM(s))) may_start_mux_now = 0;
#endif #endif
may_start_mux_now = 1;
/* process the case where the server requires the PROXY protocol to be sent */ /* process the case where the server requires the PROXY protocol to be sent */
srv_conn->send_proxy_ofs = 0; srv_conn->send_proxy_ofs = 0;