mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-06 00:31:13 +01:00
commit
b674ce68d0
@ -124,7 +124,7 @@ void zmq::raw_engine_t::error (error_reason_t reason_)
|
|||||||
// so that it knows the peer has been disconnected.
|
// so that it knows the peer has been disconnected.
|
||||||
msg_t terminator;
|
msg_t terminator;
|
||||||
terminator.init ();
|
terminator.init ();
|
||||||
(this->*_process_msg) (&terminator);
|
push_raw_msg_to_session (&terminator);
|
||||||
terminator.close ();
|
terminator.close ();
|
||||||
}
|
}
|
||||||
stream_engine_base_t::error (reason_);
|
stream_engine_base_t::error (reason_);
|
||||||
|
@ -126,11 +126,11 @@ void test_nested_topic_prefixes ()
|
|||||||
|
|
||||||
// Subscribe to other 3 (nested) topics
|
// Subscribe to other 3 (nested) topics
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (
|
TEST_ASSERT_SUCCESS_ERRNO (
|
||||||
zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE, "xyz", strlen ("a")));
|
zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE, "xyz", strlen ("xyz")));
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (
|
TEST_ASSERT_SUCCESS_ERRNO (
|
||||||
zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE, "xy", strlen ("ab")));
|
zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE, "xy", strlen ("xy")));
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (
|
TEST_ASSERT_SUCCESS_ERRNO (
|
||||||
zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE, "x", strlen ("abc")));
|
zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE, "x", strlen ("x")));
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT (get_subscription_count (subscriber), 6);
|
TEST_ASSERT_EQUAL_INT (get_subscription_count (subscriber), 6);
|
||||||
TEST_ASSERT_EQUAL_INT (get_subscription_count (publisher), 6);
|
TEST_ASSERT_EQUAL_INT (get_subscription_count (publisher), 6);
|
||||||
|
@ -73,7 +73,17 @@ void recv_string_expect_success_or_eagain (void *socket_,
|
|||||||
void test_ppoll_signals ()
|
void test_ppoll_signals ()
|
||||||
{
|
{
|
||||||
#ifdef ZMQ_HAVE_PPOLL
|
#ifdef ZMQ_HAVE_PPOLL
|
||||||
|
size_t len = MAX_SOCKET_STRING;
|
||||||
|
char my_endpoint[MAX_SOCKET_STRING];
|
||||||
pid_t child_pid;
|
pid_t child_pid;
|
||||||
|
|
||||||
|
/* Get a random TCP port first */
|
||||||
|
setup_test_context ();
|
||||||
|
void *sb = test_context_socket (ZMQ_REP);
|
||||||
|
bind_loopback (sb, 0, my_endpoint, len);
|
||||||
|
test_context_socket_close (sb);
|
||||||
|
teardown_test_context ();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
child_pid = fork ();
|
child_pid = fork ();
|
||||||
} while (child_pid == -1); // retry if fork fails
|
} while (child_pid == -1); // retry if fork fails
|
||||||
@ -85,7 +95,7 @@ void test_ppoll_signals ()
|
|||||||
int recv_timeout = 5000;
|
int recv_timeout = 5000;
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_setsockopt (
|
||||||
socket, ZMQ_RCVTIMEO, &recv_timeout, sizeof (recv_timeout)));
|
socket, ZMQ_RCVTIMEO, &recv_timeout, sizeof (recv_timeout)));
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (socket, "tcp://*:6660"));
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_bind (socket, my_endpoint));
|
||||||
// bind is on the master process to avoid zombie children to hold on to binds
|
// bind is on the master process to avoid zombie children to hold on to binds
|
||||||
|
|
||||||
// first send a test message to check whether the signal mask is setup in the child process
|
// first send a test message to check whether the signal mask is setup in the child process
|
||||||
@ -102,6 +112,7 @@ void test_ppoll_signals ()
|
|||||||
|
|
||||||
// finish
|
// finish
|
||||||
test_context_socket_close (socket);
|
test_context_socket_close (socket);
|
||||||
|
teardown_test_context ();
|
||||||
|
|
||||||
// wait for child
|
// wait for child
|
||||||
int status = 0;
|
int status = 0;
|
||||||
@ -139,8 +150,7 @@ void test_ppoll_signals ()
|
|||||||
TEST_ASSERT_SUCCESS_ERRNO (sigaction (SIGTERM, &sa, NULL));
|
TEST_ASSERT_SUCCESS_ERRNO (sigaction (SIGTERM, &sa, NULL));
|
||||||
|
|
||||||
void *socket = test_context_socket (ZMQ_REP);
|
void *socket = test_context_socket (ZMQ_REP);
|
||||||
TEST_ASSERT_SUCCESS_ERRNO (
|
TEST_ASSERT_SUCCESS_ERRNO (zmq_connect (socket, my_endpoint));
|
||||||
zmq_connect (socket, "tcp://127.0.0.1:6660"));
|
|
||||||
|
|
||||||
zmq_pollitem_t pollitems[] = {
|
zmq_pollitem_t pollitems[] = {
|
||||||
{socket, 0, ZMQ_POLLIN, 0},
|
{socket, 0, ZMQ_POLLIN, 0},
|
||||||
@ -167,6 +177,7 @@ void test_ppoll_signals ()
|
|||||||
// wait before closing socket, so that parent has time to receive
|
// wait before closing socket, so that parent has time to receive
|
||||||
sleep (1);
|
sleep (1);
|
||||||
test_context_socket_close (socket);
|
test_context_socket_close (socket);
|
||||||
|
teardown_test_context ();
|
||||||
_Exit (0);
|
_Exit (0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user