From 57440b86e2c62c78f3904abb17f11500ba0a1a6f Mon Sep 17 00:00:00 2001 From: Steven McCoy Date: Mon, 15 Aug 2011 08:56:00 +0200 Subject: Add IPv6 support to tcp_listener Signed-off-by: Steven McCoy Signed-off-by: Martin Sustrik --- src/tcp_connecter.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/tcp_connecter.cpp') diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp index b3cd563..7531445 100644 --- a/src/tcp_connecter.cpp +++ b/src/tcp_connecter.cpp @@ -199,23 +199,10 @@ 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) { -#ifdef 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 + // On some systems, IPv4 mapping in IPv6 sockets is disabled by default. + // Switch it on in such cases. + if (addr.ss_family == AF_INET6) + enable_ipv4_mapping (s); // Set the socket to non-blocking mode so that we get async connect(). unblock_socket (s); -- cgit v1.2.3