mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-21 15:12:03 +08:00
Merge pull request #2089 from bluca/ipv6_test_windows
Problem: tests should not create 2 ZMQ contexts
This commit is contained in:
commit
7f8a1da372
@ -22,9 +22,9 @@
|
|||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
setup_test_environment();
|
setup_test_environment();
|
||||||
int ipv6 = is_ipv6_available ();
|
|
||||||
void *ctx = zmq_ctx_new ();
|
void *ctx = zmq_ctx_new ();
|
||||||
assert (ctx);
|
assert (ctx);
|
||||||
|
int ipv6 = is_ipv6_available ();
|
||||||
|
|
||||||
/* Address wildcard, IPv6 disabled */
|
/* Address wildcard, IPv6 disabled */
|
||||||
void *sb = zmq_socket (ctx, ZMQ_REP);
|
void *sb = zmq_socket (ctx, ZMQ_REP);
|
||||||
|
@ -339,10 +339,6 @@ 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;
|
||||||
@ -358,9 +354,6 @@ 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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user