Commit 9adf20aa authored by Thomas Braun's avatar Thomas Braun

is_ipv6_available: Create a fake zmq context on windows

This is required as zmq_ctx_new calls WSAStartup. Without that the IPV6
socket creation always fails.
parent c9bc9397
...@@ -339,6 +339,10 @@ is_ipv6_available(void) ...@@ -339,6 +339,10 @@ is_ipv6_available(void)
inet_pton (AF_INET6, "::1", &(test_addr.sin6_addr)); inet_pton (AF_INET6, "::1", &(test_addr.sin6_addr));
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
// initialize network stack
void *ctx = zmq_ctx_new();
assert(ctx);
SOCKET fd = socket (AF_INET6, SOCK_STREAM, IPPROTO_IP); SOCKET fd = socket (AF_INET6, SOCK_STREAM, IPPROTO_IP);
if (fd == INVALID_SOCKET) if (fd == INVALID_SOCKET)
ipv6 = 0; ipv6 = 0;
...@@ -354,6 +358,9 @@ is_ipv6_available(void) ...@@ -354,6 +358,9 @@ is_ipv6_available(void)
} }
closesocket (fd); closesocket (fd);
} }
rc = zmq_ctx_term(ctx);
assert(rc == 0);
#else #else
int fd = socket (AF_INET6, SOCK_STREAM, IPPROTO_IP); int fd = socket (AF_INET6, SOCK_STREAM, IPPROTO_IP);
if (fd == -1) if (fd == -1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment