Commit dd3eb08d authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #330 from hurtonm/pair_socket_rejects_additional_connections

Do not crash when multiple peers connect to PAIR socket
parents 16ec2868 d8470949
......@@ -38,14 +38,20 @@ zmq::pair_t::~pair_t ()
void zmq::pair_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
{
zmq_assert (!pipe);
pipe = pipe_;
zmq_assert (pipe_ != NULL);
// ZMQ_PAIR socket can only be connected to a single peer.
// The socket rejects any further connection requests.
if (pipe == NULL)
pipe = pipe_;
else
pipe_->terminate (false);
}
void zmq::pair_t::xterminated (pipe_t *pipe_)
{
zmq_assert (pipe_ == pipe);
pipe = NULL;
if (pipe_ == pipe)
pipe = NULL;
}
void zmq::pair_t::xread_activated (pipe_t *pipe_)
......
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