CLEANUP: backend: Move mux install to call it at only one place

It makes the code readability simpler. It will also ease futur changes.
This commit is contained in:
Christopher Faulet 2018-02-28 10:33:34 +01:00 committed by Willy Tarreau
parent d44a9b3627
commit 2bf88c05d0

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