From 7b4a7f92b5615f7059d65918e11e48e881bd0490 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 7 Aug 2025 16:07:37 +0200 Subject: [PATCH] CLEANUP: backend: clarify the role of the init_mux variable in connect_server() The init_mux variable is currently used in a way that's not super easy to grasp. It's set a bit too late and requires to know a lot of info at once. Let's first rename it to "may_start_mux_now" to clarify its role, as the purpose is not to *force* the mux to be initialized now but to permit it to do it. --- src/backend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend.c b/src/backend.c index 00c85a401..7c70bc7ff 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 init_mux = 0; + int may_start_mux_now = 0; // are we allowed to start the mux now ? int err; struct sockaddr_storage *bind_addr = NULL; int64_t hash = 0; @@ -2029,7 +2029,7 @@ int connect_server(struct stream *s) (srv->use_ssl != 1 || (!(srv->ssl_ctx.alpn_str) && !(srv->ssl_ctx.npn_str)) || !IS_HTX_STRM(s))) #endif - init_mux = 1; + may_start_mux_now = 1; /* process the case where the server requires the PROXY protocol to be sent */ srv_conn->send_proxy_ofs = 0; @@ -2134,7 +2134,7 @@ int connect_server(struct stream *s) * initialized, or any attempt to recv during the mux init may * fail, and flag the connection as CO_FL_ERROR. */ - if (init_mux) { + if (may_start_mux_now) { const struct mux_ops *alt_mux = likely(!(s->flags & SF_WEBSOCKET)) ? NULL : srv_get_ws_proto(srv); if (conn_install_mux_be(srv_conn, s->scb, s->sess, alt_mux) < 0) {