Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
7f64b925
Commit
7f64b925
authored
Mar 24, 2019
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: code from bind_loopback_ipv4 is duplicated
Solution: call bind_loopback_ipv4 where applicable
parent
8dc933f2
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
36 deletions
+11
-36
test_conflate.cpp
tests/test_conflate.cpp
+1
-5
test_ctx_options.cpp
tests/test_ctx_options.cpp
+2
-5
test_hwm_pubsub.cpp
tests/test_hwm_pubsub.cpp
+1
-4
test_reconnect_ivl.cpp
tests/test_reconnect_ivl.cpp
+4
-7
test_router_handover.cpp
tests/test_router_handover.cpp
+1
-6
test_router_mandatory.cpp
tests/test_router_mandatory.cpp
+1
-5
test_thread_safe.cpp
tests/test_thread_safe.cpp
+1
-4
No files found.
tests/test_conflate.cpp
View file @
7f64b925
...
...
@@ -34,8 +34,6 @@ SETUP_TEARDOWN_TESTCONTEXT
void
test_conflate
()
{
const
char
*
bind_to
=
"tcp://127.0.0.1:*"
;
size_t
len
=
MAX_SOCKET_STRING
;
char
my_endpoint
[
MAX_SOCKET_STRING
];
int
rc
;
...
...
@@ -45,9 +43,7 @@ void test_conflate ()
int
conflate
=
1
;
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_setsockopt
(
s_in
,
ZMQ_CONFLATE
,
&
conflate
,
sizeof
(
conflate
)));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
s_in
,
bind_to
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
s_in
,
ZMQ_LAST_ENDPOINT
,
my_endpoint
,
&
len
));
bind_loopback_ipv4
(
s_in
,
my_endpoint
,
sizeof
my_endpoint
);
void
*
s_out
=
test_context_socket
(
ZMQ_PUSH
);
...
...
tests/test_ctx_options.cpp
View file @
7f64b925
...
...
@@ -168,13 +168,10 @@ void test_ctx_zero_copy ()
// Create a TCP socket pair using the context and test that messages can be
// received. Note that inproc sockets cannot be used for this test.
void
*
pull
=
zmq_socket
(
get_test_context
(),
ZMQ_PULL
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
pull
,
"tcp://127.0.0.1:*"
));
char
endpoint
[
MAX_SOCKET_STRING
];
bind_loopback_ipv4
(
pull
,
endpoint
,
sizeof
endpoint
);
void
*
push
=
zmq_socket
(
get_test_context
(),
ZMQ_PUSH
);
size_t
endpoint_len
=
MAX_SOCKET_STRING
;
char
endpoint
[
MAX_SOCKET_STRING
];
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
pull
,
ZMQ_LAST_ENDPOINT
,
endpoint
,
&
endpoint_len
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
push
,
endpoint
));
const
char
*
small_str
=
"abcd"
;
...
...
tests/test_hwm_pubsub.cpp
View file @
7f64b925
...
...
@@ -40,14 +40,11 @@ SETUP_TEARDOWN_TESTCONTEXT
int
test_defaults
(
int
send_hwm_
,
int
msg_cnt_
,
const
char
*
endpoint
)
{
size_t
len
=
SOCKET_STRING_LEN
;
char
pub_endpoint
[
SOCKET_STRING_LEN
];
// Set up and bind XPUB socket
void
*
pub_socket
=
test_context_socket
(
ZMQ_XPUB
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
pub_socket
,
endpoint
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
pub_socket
,
ZMQ_LAST_ENDPOINT
,
pub_endpoint
,
&
len
));
test_bind
(
pub_socket
,
endpoint
,
pub_endpoint
,
sizeof
pub_endpoint
);
// Set up and connect SUB socket
void
*
sub_socket
=
test_context_socket
(
ZMQ_SUB
);
...
...
tests/test_reconnect_ivl.cpp
View file @
7f64b925
...
...
@@ -72,15 +72,12 @@ void test_reconnect_ivl_ipc (void)
}
#endif
void
test_reconnect_ivl_tcp
(
const
char
*
address
_
)
void
test_reconnect_ivl_tcp
(
bind_function_t
bind_function
_
)
{
size_t
len
=
MAX_SOCKET_STRING
;
char
my_endpoint
[
MAX_SOCKET_STRING
];
void
*
sb
=
test_context_socket
(
ZMQ_PAIR
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
sb
,
address_
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
sb
,
ZMQ_LAST_ENDPOINT
,
my_endpoint
,
&
len
));
bind_function_
(
sb
,
my_endpoint
,
sizeof
my_endpoint
);
test_reconnect_ivl_against_pair_socket
(
my_endpoint
,
sb
);
test_context_socket_close
(
sb
);
...
...
@@ -88,14 +85,14 @@ void test_reconnect_ivl_tcp (const char *address_)
void
test_reconnect_ivl_tcp_ipv4
()
{
test_reconnect_ivl_tcp
(
"tcp://127.0.0.1:*"
);
test_reconnect_ivl_tcp
(
bind_loopback_ipv4
);
}
void
test_reconnect_ivl_tcp_ipv6
()
{
if
(
is_ipv6_available
())
{
zmq_ctx_set
(
get_test_context
(),
ZMQ_IPV6
,
1
);
test_reconnect_ivl_tcp
(
"tcp://[::1]:*"
);
test_reconnect_ivl_tcp
(
bind_loopback_ipv6
);
}
}
...
...
tests/test_router_handover.cpp
View file @
7f64b925
...
...
@@ -34,14 +34,9 @@ SETUP_TEARDOWN_TESTCONTEXT
void
test_with_handover
()
{
size_t
len
=
MAX_SOCKET_STRING
;
char
my_endpoint
[
MAX_SOCKET_STRING
];
void
*
router
=
test_context_socket
(
ZMQ_ROUTER
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
router
,
"tcp://127.0.0.1:*"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
router
,
ZMQ_LAST_ENDPOINT
,
my_endpoint
,
&
len
));
bind_loopback_ipv4
(
router
,
my_endpoint
,
sizeof
my_endpoint
);
// Enable the handover flag
int
handover
=
1
;
...
...
tests/test_router_mandatory.cpp
View file @
7f64b925
...
...
@@ -184,13 +184,9 @@ void test_get_peer_state_corner_cases ()
void
test_basic
()
{
size_t
len
=
MAX_SOCKET_STRING
;
char
my_endpoint
[
MAX_SOCKET_STRING
];
void
*
router
=
test_context_socket
(
ZMQ_ROUTER
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
router
,
"tcp://127.0.0.1:*"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
router
,
ZMQ_LAST_ENDPOINT
,
my_endpoint
,
&
len
));
bind_loopback_ipv4
(
router
,
my_endpoint
,
sizeof
my_endpoint
);
// Send a message to an unknown peer with the default setting
// This will not report any error
...
...
tests/test_thread_safe.cpp
View file @
7f64b925
...
...
@@ -43,13 +43,10 @@ void client_thread (void *client_)
void
test_thread_safe
()
{
size_t
len
=
MAX_SOCKET_STRING
;
char
my_endpoint
[
MAX_SOCKET_STRING
];
void
*
server
=
test_context_socket
(
ZMQ_SERVER
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
server
,
"tcp://127.0.0.1:*"
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_getsockopt
(
server
,
ZMQ_LAST_ENDPOINT
,
my_endpoint
,
&
len
));
bind_loopback_ipv4
(
server
,
my_endpoint
,
sizeof
my_endpoint
);
void
*
client
=
test_context_socket
(
ZMQ_CLIENT
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment