FS-5325 this should prefer v4 addrs to avoid the blocking on connect as well so you can use the dns name again

This commit is contained in:
Anthony Minessale 2013-04-24 10:49:04 -05:00
parent c6e9b9941c
commit 35b584bd19
2 changed files with 8 additions and 2 deletions

View File

@ -1 +1 @@
Wed Apr 24 10:12:23 CDT 2013
Wed Apr 24 10:48:25 CDT 2013

View File

@ -37,9 +37,14 @@ io_connect (iksparser *prs, void **socketptr, const char *server, int port)
struct addrinfo *addr_res, *addr_ptr;
char port_str[6];
int err = 0;
int family = AF_INET;
if (strchr(server, ':')) {
family = AF_INET6;
}
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
hints.ai_addrlen = 0;
@ -58,6 +63,7 @@ io_connect (iksparser *prs, void **socketptr, const char *server, int port)
if (sock != -1) {
err = IKS_NET_NOCONN;
tmp = connect (sock, addr_ptr->ai_addr, addr_ptr->ai_addrlen);
if (tmp == 0) break;
io_close ((void *) sock);
sock = -1;