mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 18:55:10 +01:00
Do not crash when multiple peers connect to PAIR socket
When more then one peer connected to a ZMQ_PAIR socket, an application aborted due to assertion failure. This patch changes the ZMQ_PAIR socket behaviour so that it rejects any further connection requests.
This commit is contained in:
parent
16ec2868c5
commit
d84709497e
14
src/pair.cpp
14
src/pair.cpp
@ -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_)
|
||||
|
Loading…
Reference in New Issue
Block a user