Commit 0655ed2e authored by Doron Somech's avatar Doron Somech

fix test unbind wildcard

parent 0934bc78
...@@ -35,19 +35,27 @@ int main (void) ...@@ -35,19 +35,27 @@ int main (void)
int rc = zmq_bind (sb, "tcp://*:5555"); int rc = zmq_bind (sb, "tcp://*:5555");
assert (rc == 0); assert (rc == 0);
char endpoint[256]; char bindEndpoint[256];
size_t endpoint_len = sizeof (endpoint); size_t endpoint_len = sizeof (bindEndpoint);
rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &endpoint_len); rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, bindEndpoint, &endpoint_len);
assert (rc == 0); assert (rc == 0);
rc = zmq_connect (sc, endpoint); char connectEndpoint[256];
#ifdef ZMQ_HAVE_WINDOWS
strcpy(connectEndpoint, "tcp://127.0.0.1:5555");
#else
strcpy(connectEndpoint, bindEndpoint);
#endif
rc = zmq_connect (sc, connectEndpoint);
assert (rc == 0); assert (rc == 0);
bounce (sb, sc); bounce (sb, sc);
rc = zmq_disconnect (sc, endpoint); rc = zmq_disconnect (sc, connectEndpoint);
assert (rc == 0); assert (rc == 0);
rc = zmq_unbind (sb, endpoint); rc = zmq_unbind (sb, bindEndpoint);
assert (rc == 0); assert (rc == 0);
rc = zmq_close (sc); rc = zmq_close (sc);
...@@ -69,19 +77,28 @@ int main (void) ...@@ -69,19 +77,28 @@ int main (void)
rc = zmq_bind (sb, "tcp://*:5556"); rc = zmq_bind (sb, "tcp://*:5556");
assert (rc == 0); assert (rc == 0);
endpoint_len = sizeof (endpoint); endpoint_len = sizeof (bindEndpoint);
memset(endpoint, 0, endpoint_len); memset(bindEndpoint, 0, endpoint_len);
rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &endpoint_len); rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, bindEndpoint, &endpoint_len);
assert (rc == 0); assert (rc == 0);
rc = zmq_connect (sc, endpoint); #ifdef ZMQ_HAVE_WINDOWS
if (ipv6)
strcpy(connectEndpoint, "tcp://[::1]:5556");
else
strcpy(connectEndpoint, "tcp://127.0.0.1:5556");
#else
strcpy(connectEndpoint, bindEndpoint);
#endif
rc = zmq_connect (sc, connectEndpoint);
assert (rc == 0); assert (rc == 0);
bounce (sb, sc); bounce (sb, sc);
rc = zmq_disconnect (sc, endpoint); rc = zmq_disconnect (sc, connectEndpoint);
assert (rc == 0); assert (rc == 0);
rc = zmq_unbind (sb, endpoint); rc = zmq_unbind (sb, bindEndpoint);
assert (rc == 0); assert (rc == 0);
rc = zmq_close (sc); rc = zmq_close (sc);
...@@ -98,6 +115,7 @@ int main (void) ...@@ -98,6 +115,7 @@ int main (void)
rc = zmq_bind (sb, "tcp://127.0.0.1:*"); rc = zmq_bind (sb, "tcp://127.0.0.1:*");
assert (rc == 0); assert (rc == 0);
char endpoint[256];
endpoint_len = sizeof (endpoint); endpoint_len = sizeof (endpoint);
memset(endpoint, 0, endpoint_len); memset(endpoint, 0, endpoint_len);
rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &endpoint_len); rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &endpoint_len);
......
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