summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteven McCoy <steven.mccoy@miru.hk>2011-08-08 16:07:54 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-08-08 16:07:54 +0200
commit1c54ce37b343bda66d25faaa970a5414546cdd92 (patch)
tree1a9c64acf123caed5f7530b045ee6ec2f4362240 /src
parentc27b9ac7defd3cf7d21d93b2a3d2a9142a12e82f (diff)
tcp_connecter disables IPV6_IPV6ONLY if needed.
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk> Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src')
-rw-r--r--src/tcp_connecter.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp
index 6badaea..f950896 100644
--- a/src/tcp_connecter.cpp
+++ b/src/tcp_connecter.cpp
@@ -198,6 +198,24 @@ int zmq::tcp_connecter_t::open ()
return -1;
#endif
+ // Enable IPv4-mapping of addresses in case it is disabled by default.
+#ifdef IPV6_V6ONLY
+ if (addr.ss_family == AF_INET6) {
+#if ZMQ_HAVE_WINDOWS
+ DWORD flag = 0;
+#else
+ int flag = 0;
+#endif
+ int rc = setsockopt (s, IPPROTO_IPV6, IPV6_V6ONLY,
+ (const char*) &flag, sizeof (flag));
+#ifdef ZMQ_HAVE_WINDOWS
+ wsa_assert (rc != SOCKET_ERROR);
+#else
+ errno_assert (rc == 0);
+#endif
+ }
+#endif
+
// Set the socket to non-blocking mode so that we get async connect().
unblock_socket (s);