mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 19:52:00 +01:00
REQ: Unset reply_pipe if it terminates.
* Fixes a terminate() call on a dangling pointer in the SEND_RESETS case. * Fixes recv_reply_pipe() never receiving a message once the pipe it is waiting on is terminated.
This commit is contained in:
@@ -219,6 +219,13 @@ int zmq::req_t::xsetsockopt(int option_, const void *optval_, size_t optvallen_)
|
||||
return dealer_t::xsetsockopt (option_, optval_, optvallen_);
|
||||
}
|
||||
|
||||
void zmq::req_t::xpipe_terminated (pipe_t *pipe_)
|
||||
{
|
||||
if (reply_pipe == pipe_)
|
||||
reply_pipe = NULL;
|
||||
dealer_t::xpipe_terminated (pipe_);
|
||||
}
|
||||
|
||||
int zmq::req_t::recv_reply_pipe (msg_t *msg_)
|
||||
{
|
||||
while (true) {
|
||||
@@ -226,7 +233,7 @@ int zmq::req_t::recv_reply_pipe (msg_t *msg_)
|
||||
int rc = dealer_t::recvpipe (msg_, &pipe);
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
if (pipe == reply_pipe)
|
||||
if (!reply_pipe || pipe == reply_pipe)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace zmq
|
||||
bool xhas_in ();
|
||||
bool xhas_out ();
|
||||
int xsetsockopt (int option_, const void *optval_, size_t optvallen_);
|
||||
void xpipe_terminated (zmq::pipe_t *pipe_);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user