Commit 3901d94b authored by Martin Hurton's avatar Martin Hurton

Fix race condition in connecting inproc sockets

parent 414fc86b
...@@ -445,6 +445,14 @@ void zmq::ctx_t::connect_inproc_sockets (zmq::socket_base_t *bind_socket_, ...@@ -445,6 +445,14 @@ void zmq::ctx_t::connect_inproc_sockets (zmq::socket_base_t *bind_socket_,
bind_socket_->inc_seqnum(); bind_socket_->inc_seqnum();
pending_connection_.bind_pipe->set_tid(bind_socket_->get_tid()); 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) { if (side_ == bind_side) {
command_t cmd; command_t cmd;
cmd.type = command_t::bind; cmd.type = command_t::bind;
...@@ -474,14 +482,6 @@ void zmq::ctx_t::connect_inproc_sockets (zmq::socket_base_t *bind_socket_, ...@@ -474,14 +482,6 @@ void zmq::ctx_t::connect_inproc_sockets (zmq::socket_base_t *bind_socket_,
pending_connection_.connect_pipe->set_hwms(hwms [1], hwms [0]); pending_connection_.connect_pipe->set_hwms(hwms [1], hwms [0]);
pending_connection_.bind_pipe->set_hwms(hwms [0], hwms [1]); 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) { if (pending_connection_.endpoint.options.recv_identity) {
msg_t id; msg_t id;
int rc = id.init_size (bind_options.identity_size); int rc = id.init_size (bind_options.identity_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment