0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 15:41:05 +08:00

Problem: code from bind_loopback_ipc is duplicated

Solution: call bind_loopback_ipc where applicable
This commit is contained in:
Simon Giesecke 2019-03-24 13:19:36 -04:00
parent 7f64b925aa
commit 0e0bead3cf
3 changed files with 4 additions and 17 deletions

View File

@ -35,12 +35,8 @@ SETUP_TEARDOWN_TESTCONTEXT
void test_ipc_wildcard ()
{
void *sb = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
char endpoint[200];
size_t size = sizeof (endpoint);
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, endpoint, &size));
bind_loopback_ipc (sb, endpoint, sizeof endpoint);
void *sc = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, endpoint));

View File

@ -35,12 +35,9 @@ SETUP_TEARDOWN_TESTCONTEXT
void test_roundtrip ()
{
char my_endpoint[256];
size_t len = sizeof (my_endpoint);
void *sb = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
bind_loopback_ipc (sb, my_endpoint, sizeof my_endpoint);
void *sc = test_context_socket (ZMQ_PAIR);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));

View File

@ -39,10 +39,7 @@ void test_leak ()
char my_endpoint[256];
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
size_t len = sizeof (my_endpoint);
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
bind_loopback_ipc (sb, my_endpoint, sizeof my_endpoint);
void *sc = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));
@ -67,10 +64,7 @@ void test_simple (void)
char my_endpoint[256];
void *sb = test_context_socket (ZMQ_REP);
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (sb, "ipc://*"));
size_t len = sizeof (my_endpoint);
TEST_ASSERT_SUCCESS_ERRNO (
zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len));
bind_loopback_ipc (sb, my_endpoint, sizeof my_endpoint);
void *sc = test_context_socket (ZMQ_REQ);
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (sc, my_endpoint));