mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-15 18:38:00 +08:00
Fix race condition in connecting inproc sockets
This is a backport of libzmq:3678c32b9 by Martin Hurton <hurtonm@gmail.com>
This commit is contained in:
parent
a6bd295210
commit
d4d26b1cc0
16
src/ctx.cpp
16
src/ctx.cpp
@ -445,6 +445,14 @@ void zmq::ctx_t::connect_inproc_sockets(zmq::socket_base_t *bind_socket_, option
|
||||
bind_socket_->inc_seqnum();
|
||||
pending_connection_.bind_pipe->set_tid(bind_socket_->get_tid());
|
||||
|
||||
if (!bind_options.recv_identity) {
|
||||
msg_t msg;
|
||||
const bool ok = pending_connection_.bind_pipe->read (&msg);
|
||||
zmq_assert (ok);
|
||||
const int rc = msg.close ();
|
||||
errno_assert (rc == 0);
|
||||
}
|
||||
|
||||
if (side_ == bind_side)
|
||||
{
|
||||
command_t cmd;
|
||||
@ -476,14 +484,6 @@ void zmq::ctx_t::connect_inproc_sockets(zmq::socket_base_t *bind_socket_, option
|
||||
pending_connection_.connect_pipe->set_hwms(hwms [1], hwms [0]);
|
||||
pending_connection_.bind_pipe->set_hwms(hwms [0], hwms [1]);
|
||||
|
||||
if (!bind_options.recv_identity) {
|
||||
msg_t msg;
|
||||
const bool ok = pending_connection_.bind_pipe->read (&msg);
|
||||
zmq_assert (ok);
|
||||
const int rc = msg.close ();
|
||||
errno_assert (rc == 0);
|
||||
}
|
||||
|
||||
if (pending_connection_.endpoint.options.recv_identity) {
|
||||
msg_t id;
|
||||
int rc = id.init_size (bind_options.identity_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user