0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-29 00:32:34 +08:00

tcp_connecter disables IPV6_IPV6ONLY if needed.

Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Steven McCoy 2011-08-08 16:07:54 +02:00 committed by Martin Sustrik
parent c27b9ac7de
commit 1c54ce37b3

View File

@ -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);