diff --git a/src/checks.c b/src/checks.c index 63747201e..eaf84a225 100644 --- a/src/checks.c +++ b/src/checks.c @@ -1564,18 +1564,6 @@ static int connect_conn_chk(struct task *t) conn->addr.to = s->addr; } - if ((conn->addr.to.ss_family == AF_INET) || (conn->addr.to.ss_family == AF_INET6)) { - int i = 0; - - i = srv_check_healthcheck_port(check); - if (i == 0) { - cs->data = check; - return SF_ERR_CHK_PORT; - } - - set_host_port(&conn->addr.to, i); - } - proto = protocol_by_family(conn->addr.to.ss_family); conn_prepare(conn, proto, check->xprt); @@ -1583,6 +1571,16 @@ static int connect_conn_chk(struct task *t) 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)) { + int i = 0; + + i = srv_check_healthcheck_port(check); + if (i == 0) + return SF_ERR_CHK_PORT; + + set_host_port(&conn->addr.to, i); + } + /* no client address */ clear_addr(&conn->addr.from);