client: try to connect to all addresses before giving up

Don't give up when one of the addresses/hostnames specified by -h fails
to resolve in DNS_Name2IPAddress(), e.g. with the default setting try to
connect to ::1 even when 127.0.0.1 failed due to the -6 option.
This commit is contained in:
Miroslav Lichvar 2017-05-25 16:12:50 +02:00
parent 46fad717e5
commit c049bce007

View file

@ -172,7 +172,7 @@ get_sockaddrs(const char *hostnames, int port)
} else {
if (DNS_Name2IPAddress(hostname, ip_addrs, DNS_MAX_ADDRESSES) != DNS_Success) {
DEBUG_LOG("Could not get IP address for %s", hostname);
break;
continue;
}
for (i = 0; i < DNS_MAX_ADDRESSES && ip_addrs[i].family != IPADDR_UNSPEC; i++) {