summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/tcp.c
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2014-01-27 21:30:51 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2014-01-27 21:30:51 +0400
commit64d33a751935bb0fa9fad8f6525dcd378b5fe3da (patch)
treed2c7d5106014ec7c7aeafadfbee5ef50735e8e53 /deps/uv/src/unix/tcp.c
parentcc4b6e6e582e868cba9f84195f62a51721f8cbad (diff)
downloadandroid-node-v8-64d33a751935bb0fa9fad8f6525dcd378b5fe3da.tar.gz
android-node-v8-64d33a751935bb0fa9fad8f6525dcd378b5fe3da.tar.bz2
android-node-v8-64d33a751935bb0fa9fad8f6525dcd378b5fe3da.zip
deps: update uv to 0.11.18
Diffstat (limited to 'deps/uv/src/unix/tcp.c')
-rw-r--r--deps/uv/src/unix/tcp.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/deps/uv/src/unix/tcp.c b/deps/uv/src/unix/tcp.c
index e5f226c1f5..2c36dc3ffc 100644
--- a/deps/uv/src/unix/tcp.c
+++ b/deps/uv/src/unix/tcp.c
@@ -58,7 +58,8 @@ static int maybe_new_socket(uv_tcp_t* handle, int domain, int flags) {
int uv__tcp_bind(uv_tcp_t* tcp,
const struct sockaddr* addr,
- unsigned int addrlen) {
+ unsigned int addrlen,
+ unsigned int flags) {
int err;
int on;
@@ -72,6 +73,19 @@ int uv__tcp_bind(uv_tcp_t* tcp,
if (setsockopt(tcp->io_watcher.fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)))
return -errno;
+#ifdef IPV6_V6ONLY
+ if (addr->sa_family == AF_INET6) {
+ on = (flags & UV_TCP_IPV6ONLY) != 0;
+ if (setsockopt(tcp->io_watcher.fd,
+ IPPROTO_IPV6,
+ IPV6_V6ONLY,
+ &on,
+ sizeof on) == -1) {
+ return -errno;
+ }
+ }
+#endif
+
errno = 0;
if (bind(tcp->io_watcher.fd, addr, addrlen) && errno != EADDRINUSE)
return -errno;