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.
This commit is contained in:
Willy Tarreau 2025-08-07 16:07:37 +02:00 committed by Olivier Houchard
parent ff47ae60f3
commit 7b4a7f92b5

View 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) {