mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 18:40:27 +01:00
Merge pull request #1481 from brian-peloton/master
Fix several missing msg_t::close calls.
This commit is contained in:
commit
c05a475bf7
@ -229,6 +229,8 @@ int zmq::stream_t::xrecv (msg_t *msg_)
|
||||
// Rather than sendig this frame, we keep it in prefetched
|
||||
// buffer and send a frame with peer's ID.
|
||||
blob_t identity = pipe->get_identity ();
|
||||
rc = msg_->close();
|
||||
errno_assert (rc == 0);
|
||||
rc = msg_->init_size (identity.size ());
|
||||
errno_assert (rc == 0);
|
||||
|
||||
|
@ -56,6 +56,8 @@ int main (void)
|
||||
rc = zmq_msg_send(&msg, client, 0);
|
||||
assert (rc == 1);
|
||||
|
||||
rc = zmq_msg_init(&msg);
|
||||
assert (rc == 0);
|
||||
rc = zmq_msg_recv(&msg, server, 0);
|
||||
assert (rc == 1);
|
||||
|
||||
@ -80,6 +82,9 @@ int main (void)
|
||||
rc = zmq_msg_recv(&msg, client, 0);
|
||||
assert (rc == 1);
|
||||
|
||||
rc = zmq_msg_close(&msg);
|
||||
assert (rc == 0);
|
||||
|
||||
rc = zmq_close (server);
|
||||
assert (rc == 0);
|
||||
|
||||
|
@ -75,6 +75,9 @@ int main (void)
|
||||
int srcFd = zmq_msg_get(&msg, ZMQ_SRCFD);
|
||||
assert(srcFd >= 0);
|
||||
|
||||
rc = zmq_msg_close(&msg);
|
||||
assert (rc == 0);
|
||||
|
||||
// get the remote endpoint
|
||||
struct sockaddr_storage ss;
|
||||
#ifdef ZMQ_HAVE_HPUX
|
||||
|
@ -91,6 +91,8 @@ int main(int, char**)
|
||||
assert (rc != -1);
|
||||
assert(zmq_msg_size (&peer_frame) > 0);
|
||||
assert (has_more (sockets [SERVER]));
|
||||
rc = zmq_msg_close (&peer_frame);
|
||||
assert (rc == 0);
|
||||
|
||||
// Server: Grab the 2nd frame (actual payload).
|
||||
zmq_msg_t data_frame;
|
||||
@ -99,6 +101,8 @@ int main(int, char**)
|
||||
rc = zmq_msg_recv (&data_frame, sockets [SERVER], 0);
|
||||
assert (rc != -1);
|
||||
assert(zmq_msg_size (&data_frame) == 0);
|
||||
rc = zmq_msg_close (&data_frame);
|
||||
assert (rc == 0);
|
||||
|
||||
// Client: Grab the 1st frame (peer identity).
|
||||
rc = zmq_msg_init (&peer_frame);
|
||||
@ -107,6 +111,8 @@ int main(int, char**)
|
||||
assert (rc != -1);
|
||||
assert(zmq_msg_size (&peer_frame) > 0);
|
||||
assert (has_more (sockets [CLIENT]));
|
||||
rc = zmq_msg_close (&peer_frame);
|
||||
assert (rc == 0);
|
||||
|
||||
// Client: Grab the 2nd frame (actual payload).
|
||||
rc = zmq_msg_init (&data_frame);
|
||||
@ -114,6 +120,8 @@ int main(int, char**)
|
||||
rc = zmq_msg_recv (&data_frame, sockets [CLIENT], 0);
|
||||
assert (rc != -1);
|
||||
assert(zmq_msg_size (&data_frame) == 0);
|
||||
rc = zmq_msg_close (&data_frame);
|
||||
assert (rc == 0);
|
||||
|
||||
// Send initial message.
|
||||
char blob_data [256];
|
||||
|
Loading…
Reference in New Issue
Block a user