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:
parent
7f64b925aa
commit
0e0bead3cf
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user