Skip to content
Browse files

Merge pull request #1 from skinkie/84e068bc4ead672c60b6ceae82096f4dc4…

…cbfdc4

Fixes in the Information Source internals. Internally, it was treating both IPv4 and IPv6 addresses as IPv4.
  • Loading branch information...
2 parents dea28fe + 84e068b commit 51d2fb582b899f1fcb7a81478394b32a95560588 @alobbs alobbs committed Oct 13, 2011
Showing with 14 additions and 2 deletions.
  1. +14 −2 cherokee/source.c
View
16 cherokee/source.c
@@ -161,13 +161,25 @@ cherokee_source_connect (cherokee_source_t *src, cherokee_socket_t *sock)
addr = addr_info;
continue;
}
+
+ cherokee_socket_close(sock);
}
/* Update the new socket with the address info
*/
- SOCKET_ADDR_IPv4(sock)->sin_port = htons(src->port);
+ switch (src->addr_current->ai_family) {
+ case AF_INET:
+ SOCKET_ADDR_IPv4(sock)->sin_port = htons(src->port);
+ break;
+ case AF_INET6:
+ SOCKET_ADDR_IPv6(sock)->sin6_port = htons(src->port);
+ break;
+ default:
+ SHOULDNT_HAPPEN;
+ return ret_error;
+ }
- ret = cherokee_socket_update_from_addrinfo (sock, addr_info, 0);
+ ret = cherokee_socket_update_from_addrinfo (sock, src->addr_current, 0);
if (unlikely (ret != ret_ok)) {
return ret_error;
}

0 comments on commit 51d2fb5

Please sign in to comment.
Something went wrong with that request. Please try again.