diff options
Diffstat (limited to 'src/pair.cpp')
-rw-r--r-- | src/pair.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/pair.cpp b/src/pair.cpp index b4cb0b4..531bfc5 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -38,14 +38,20 @@ xs::pair_t::~pair_t () void xs::pair_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_) { - xs_assert (!pipe); - pipe = pipe_; + xs_assert (pipe_ != NULL); + + // XS_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 xs::pair_t::xterminated (pipe_t *pipe_) { - xs_assert (pipe_ == pipe); - pipe = NULL; + if (pipe_ == pipe) + pipe = NULL; } void xs::pair_t::xread_activated (pipe_t *pipe_) |