Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #246 from luvit/fix_ipv6_resolver_new
dns: fix ipv6 resolver
  • Loading branch information
creationix committed Jun 11, 2012
2 parents 36b4c7a + 1d8db4c commit 12449bf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/luv_dns.c
Expand Up @@ -499,7 +499,11 @@ static void luv_dns_getaddrinfo_callback(uv_getaddrinfo_t* res, int status,

for (curr=start; curr; curr=curr->ai_next) {
if (curr->ai_family == AF_INET || curr->ai_family == AF_INET6) {
addr = (char*) &((struct sockaddr_in*) curr->ai_addr)->sin_addr;
if (curr->ai_family == AF_INET) {
addr = (char*) &((struct sockaddr_in*) curr->ai_addr)->sin_addr;
} else {
addr = (char*) &((struct sockaddr_in6*) curr->ai_addr)->sin6_addr;
}
uv_inet_ntop(curr->ai_family, addr, ip, INET6_ADDRSTRLEN);
lua_pushstring(ref->L, ip);
lua_rawseti(ref->L, -2, n++);
Expand Down

0 comments on commit 12449bf

Please sign in to comment.