From 4aaf0bfbced22d706af08725f977dcce9845d340 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 7 Aug 2025 16:30:38 +0200 Subject: [PATCH] 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. --- src/backend.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend.c b/src/backend.c index 7c70bc7ff..5e757ae76 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1793,7 +1793,7 @@ int connect_server(struct stream *s) struct server *srv; int reuse_mode; 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; struct sockaddr_storage *bind_addr = NULL; int64_t hash = 0; @@ -1841,6 +1841,7 @@ int connect_server(struct stream *s) if (err == SF_ERR_NONE) { srv_conn = sc_conn(s->scb); 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 * anyway. */ - if (!srv || - (srv->use_ssl != 1 || (!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || - !IS_HTX_STRM(s))) + if (IS_HTX_STRM(s) && srv && srv->use_ssl && + (srv->ssl_ctx.alpn_str || srv->ssl_ctx.npn_str)) + may_start_mux_now = 0; #endif - may_start_mux_now = 1; /* process the case where the server requires the PROXY protocol to be sent */ srv_conn->send_proxy_ofs = 0;