]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: backend: Move mux install to call it at only one place
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 28 Feb 2018 09:33:34 +0000 (10:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 Aug 2018 12:37:37 +0000 (14:37 +0200)
It makes the code readability simpler. It will also ease futur changes.

src/backend.c

index b2b7ba580cf7676a29835d02e196934a885737c1..f7e5dbddfdebcdf03571b5e8c8bd241e3f804839 100644 (file)
@@ -1178,22 +1178,20 @@ int connect_server(struct stream *s)
                srv_conn->target = s->target;
 
                /* set the correct protocol on the output stream interface */
-               if (srv) {
+               if (srv)
                        conn_prepare(srv_conn, protocol_by_family(srv_conn->addr.to.ss_family), srv->xprt);
-                       /* XXX: Pick the right mux, when we finally have one */
-                       conn_install_mux(srv_conn, &mux_pt_ops, srv_cs);
-               }
                else if (obj_type(s->target) == OBJ_TYPE_PROXY) {
                        /* proxies exclusively run on raw_sock right now */
                        conn_prepare(srv_conn, protocol_by_family(srv_conn->addr.to.ss_family), xprt_get(XPRT_RAW));
                        if (!objt_cs(s->si[1].end) || !objt_cs(s->si[1].end)->conn->ctrl)
                                return SF_ERR_INTERNAL;
-                       /* XXX: Pick the right mux, when we finally have one */
-                       conn_install_mux(srv_conn, &mux_pt_ops, srv_cs);
                }
                else
                        return SF_ERR_INTERNAL;  /* how did we get there ? */
 
+               /* XXX: Pick the right mux, when we finally have one */
+               conn_install_mux(srv_conn, &mux_pt_ops, srv_cs);
+
                /* process the case where the server requires the PROXY protocol to be sent */
                srv_conn->send_proxy_ofs = 0;
                cli_conn = objt_conn(strm_orig(s));