mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-11 18:17:14 +01:00
Merge pull request #3509 from jean-airoldie/monitor_typed
Problem: Potentially unitialized variable in #3508
This commit is contained in:
@@ -143,6 +143,15 @@ void test_monitor_versioned_typed_basic (bind_function_t bind_function_,
|
|||||||
int type_)
|
int type_)
|
||||||
{
|
{
|
||||||
char server_endpoint[MAX_SOCKET_STRING];
|
char server_endpoint[MAX_SOCKET_STRING];
|
||||||
|
char client_mon_endpoint[MAX_SOCKET_STRING];
|
||||||
|
char server_mon_endpoint[MAX_SOCKET_STRING];
|
||||||
|
|
||||||
|
// Create a unique endpoint for each call so we don't have
|
||||||
|
// to wait for the sockets to unbind.
|
||||||
|
snprintf (client_mon_endpoint, MAX_SOCKET_STRING, "inproc://client%s%d",
|
||||||
|
expected_prefix_, type_);
|
||||||
|
snprintf (server_mon_endpoint, MAX_SOCKET_STRING, "inproc://server%s%d",
|
||||||
|
expected_prefix_, type_);
|
||||||
|
|
||||||
// We'll monitor these two sockets
|
// We'll monitor these two sockets
|
||||||
void *client = test_context_socket (ZMQ_DEALER);
|
void *client = test_context_socket (ZMQ_DEALER);
|
||||||
@@ -150,12 +159,12 @@ void test_monitor_versioned_typed_basic (bind_function_t bind_function_,
|
|||||||
|
|
||||||
// Monitor all events on client and server sockets
|
// Monitor all events on client and server sockets
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_socket_monitor_versioned_typed (
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_socket_monitor_versioned_typed (
|
||||||
client, "inproc://monitor-client", ZMQ_EVENT_ALL_V2, 2, type_));
|
client, client_mon_endpoint, ZMQ_EVENT_ALL_V2, 2, type_));
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_socket_monitor_versioned_typed (
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_socket_monitor_versioned_typed (
|
||||||
server, "inproc://monitor-server", ZMQ_EVENT_ALL_V2, 2, type_));
|
server, server_mon_endpoint, ZMQ_EVENT_ALL_V2, 2, type_));
|
||||||
|
|
||||||
// Choose the appropriate consumer socket type.
|
// Choose the appropriate consumer socket type.
|
||||||
int mon_type;
|
int mon_type = ZMQ_PAIR;
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case ZMQ_PAIR:
|
case ZMQ_PAIR:
|
||||||
mon_type = ZMQ_PAIR;
|
mon_type = ZMQ_PAIR;
|
||||||
@@ -181,10 +190,8 @@ void test_monitor_versioned_typed_basic (bind_function_t bind_function_,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Connect these to the inproc endpoints so they'll get events
|
// Connect these to the inproc endpoints so they'll get events
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (client_mon, client_mon_endpoint));
|
||||||
zmq_connect (client_mon, "inproc://monitor-client"));
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (server_mon, server_mon_endpoint));
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (
|
|
||||||
zmq_connect (server_mon, "inproc://monitor-server"));
|
|
||||||
|
|
||||||
// Now do a basic ping test
|
// Now do a basic ping test
|
||||||
bind_function_ (server, server_endpoint, sizeof server_endpoint);
|
bind_function_ (server, server_endpoint, sizeof server_endpoint);
|
||||||
@@ -255,10 +262,6 @@ void test_monitor_versioned_typed_basic (bind_function_t bind_function_,
|
|||||||
// TODO why does this use zero_linger?
|
// TODO why does this use zero_linger?
|
||||||
test_context_socket_close_zero_linger (client_mon);
|
test_context_socket_close_zero_linger (client_mon);
|
||||||
test_context_socket_close_zero_linger (server_mon);
|
test_context_socket_close_zero_linger (server_mon);
|
||||||
|
|
||||||
// Wait for the monitor socket's endpoint to be available
|
|
||||||
// for reuse.
|
|
||||||
msleep (SETTLE_TIME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_monitor_versioned_basic_tcp_ipv4 ()
|
void test_monitor_versioned_basic_tcp_ipv4 ()
|
||||||
|
|||||||
Reference in New Issue
Block a user