mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-15 10:18:01 +08:00
Allow zmq_msg_gets checks to assert rather than segfault
This commit is contained in:
parent
700f7bfede
commit
d47980a6ed
@ -81,7 +81,9 @@ test_stream_to_dealer (void)
|
|||||||
assert (zmq_msg_more (&identity));
|
assert (zmq_msg_more (&identity));
|
||||||
|
|
||||||
// Verify the existence of Peer-Address metadata
|
// Verify the existence of Peer-Address metadata
|
||||||
assert (streq (zmq_msg_gets (&identity, "Peer-Address"), "127.0.0.1"));
|
char const* peer_address = zmq_msg_gets (&identity, "Peer-Address");
|
||||||
|
assert (peer_address != 0);
|
||||||
|
assert (streq (peer_address, "127.0.0.1"));
|
||||||
|
|
||||||
// Second frame is zero
|
// Second frame is zero
|
||||||
byte buffer [255];
|
byte buffer [255];
|
||||||
@ -89,7 +91,9 @@ test_stream_to_dealer (void)
|
|||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
|
|
||||||
// Verify the existence of Peer-Address metadata
|
// Verify the existence of Peer-Address metadata
|
||||||
assert (streq (zmq_msg_gets (&identity, "Peer-Address"), "127.0.0.1"));
|
peer_address = zmq_msg_gets (&identity, "Peer-Address");
|
||||||
|
assert (peer_address != 0);
|
||||||
|
assert (streq (peer_address, "127.0.0.1"));
|
||||||
|
|
||||||
// Real data follows
|
// Real data follows
|
||||||
// First frame is identity
|
// First frame is identity
|
||||||
@ -98,7 +102,9 @@ test_stream_to_dealer (void)
|
|||||||
assert (zmq_msg_more (&identity));
|
assert (zmq_msg_more (&identity));
|
||||||
|
|
||||||
// Verify the existence of Peer-Address metadata
|
// Verify the existence of Peer-Address metadata
|
||||||
assert (streq (zmq_msg_gets (&identity, "Peer-Address"), "127.0.0.1"));
|
peer_address = zmq_msg_gets (&identity, "Peer-Address");
|
||||||
|
assert (peer_address != 0);
|
||||||
|
assert (streq (peer_address, "127.0.0.1"));
|
||||||
|
|
||||||
// Second frame is greeting signature
|
// Second frame is greeting signature
|
||||||
rc = zmq_recv (stream, buffer, 255, 0);
|
rc = zmq_recv (stream, buffer, 255, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user