提交 35b584bd authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-5325 this should prefer v4 addrs to avoid the blocking on connect as well so…

FS-5325 this should prefer v4 addrs to avoid the blocking on connect as well so you can use the dns name again
上级 c6e9b994
Wed Apr 24 10:12:23 CDT 2013
Wed Apr 24 10:48:25 CDT 2013
......@@ -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;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论