BUG/MINOR: proto_reverse_connect: fix preconnect with startup name resolution
addr member of server structure is not set consistently depending on the server address type. When using <IP:PORT> notation, its port is properly set. However, when using <HOSTNAME:PORT>, only IP address is set after startup name resolution but its port is left to 0. This behavior causes preconnect to not be functional when using server with hostname for startup name resolution. Indeed, only srv.addr is used as connect argument through function new_reverse_conn(). To fix this, rely on srv.svc_port : this member is always set for servers using IP or hostname. This is similar to connect_server() on the backend side. This does not need to be backported.
This commit is contained in:
parent
6a9ba85322
commit
9b6812d781
|
@ -62,6 +62,7 @@ static struct connection *new_reverse_conn(struct listener *l, struct server *sr
|
||||||
if (!conn->dst)
|
if (!conn->dst)
|
||||||
goto err;
|
goto err;
|
||||||
*conn->dst = srv->addr;
|
*conn->dst = srv->addr;
|
||||||
|
set_host_port(conn->dst, srv->svc_port);
|
||||||
|
|
||||||
if (conn_prepare(conn, protocol_lookup(conn->dst->ss_family, PROTO_TYPE_STREAM, 0), srv->xprt))
|
if (conn_prepare(conn, protocol_lookup(conn->dst->ss_family, PROTO_TYPE_STREAM, 0), srv->xprt))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
Loading…
Reference in New Issue