MINOR: connection: make the initialization more consistent

Sometimes a connection is prepared before the target is set, sometimes
after. There's no real rule since the few functions involved operate on
different and independent fields. Soon we'll benefit from knowing the
target at the connection layer, in order to figure the associated proxy
and retrieve the various parameters (timeouts etc). This patch slightly
reorders a few calls to conn_prepare() so that we can make sure that the
target is always known to the mux.
diff --git a/src/checks.c b/src/checks.c
index fc13845..28ee4c4 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1588,13 +1588,9 @@
 	}
 
 	proto = protocol_by_family(conn->addr.to.ss_family);
-
-	conn_prepare(conn, proto, check->xprt);
-	conn_install_mux(conn, &mux_pt_ops, cs);
-	cs_attach(cs, check, &check_conn_cb);
 	conn->target = &s->obj_type;
 
-       if ((conn->addr.to.ss_family == AF_INET) || (conn->addr.to.ss_family == AF_INET6)) {
+	if ((conn->addr.to.ss_family == AF_INET) || (conn->addr.to.ss_family == AF_INET6)) {
 		int i = 0;
 
 		i = srv_check_healthcheck_port(check);
@@ -1607,6 +1603,10 @@
 	/* no client address */
 	clear_addr(&conn->addr.from);
 
+	conn_prepare(conn, proto, check->xprt);
+	conn_install_mux(conn, &mux_pt_ops, cs);
+	cs_attach(cs, check, &check_conn_cb);
+
 	/* only plain tcp-check supports quick ACK */
 	quickack = check->type == 0 || check->type == PR_O2_TCPCHK_CHK;
 
@@ -2766,7 +2766,6 @@
 
 			check->cs = cs;
 			conn = cs->conn;
-			cs_attach(cs, check, &check_conn_cb);
 			conn->target = &s->obj_type;
 
 			/* no client address */
@@ -2796,8 +2795,10 @@
 			else {
 				xprt = xprt_get(XPRT_RAW);
 			}
+
 			conn_prepare(conn, proto, xprt);
 			conn_install_mux(conn, &mux_pt_ops, cs);
+			cs_attach(cs, check, &check_conn_cb);
 
 			ret = SF_ERR_INTERNAL;
 			if (proto->connect)