]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: backend: clarify the role of the init_mux variable in connect_server()
authorWilly Tarreau <w@1wt.eu>
Thu, 7 Aug 2025 14:07:37 +0000 (16:07 +0200)
committerOlivier Houchard <cognet@ci0.org>
Tue, 9 Sep 2025 17:01:24 +0000 (19:01 +0200)
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

index 00c85a401a26f3b2d306e4b58b6139683c13be81..7c70bc7ff52f6387252265a0a6722742d4285842 100644 (file)
@@ -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) {