Commit 8485a5e5 authored by Martin Sustrik's avatar Martin Sustrik

Assert fixed in XREP & ROUTER when sending to terminating pipe (issue 258)

Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent d726120e
...@@ -179,8 +179,9 @@ int zmq::router_t::xsend (msg_t *msg_, int flags_) ...@@ -179,8 +179,9 @@ int zmq::router_t::xsend (msg_t *msg_, int flags_)
// Push the message into the pipe. If there's no out pipe, just drop it. // Push the message into the pipe. If there's no out pipe, just drop it.
if (current_out) { if (current_out) {
bool ok = current_out->write (msg_); bool ok = current_out->write (msg_);
zmq_assert (ok); if (unlikely (!ok))
if (!more_out) { current_out = NULL;
else if (!more_out) {
current_out->flush (); current_out->flush ();
current_out = NULL; current_out = NULL;
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "pipe.hpp" #include "pipe.hpp"
#include "wire.hpp" #include "wire.hpp"
#include "random.hpp" #include "random.hpp"
#include "likely.hpp"
#include "err.hpp" #include "err.hpp"
zmq::xrep_t::xrep_t (class ctx_t *parent_, uint32_t tid_) : zmq::xrep_t::xrep_t (class ctx_t *parent_, uint32_t tid_) :
...@@ -163,8 +164,9 @@ int zmq::xrep_t::xsend (msg_t *msg_, int flags_) ...@@ -163,8 +164,9 @@ int zmq::xrep_t::xsend (msg_t *msg_, int flags_)
// Push the message into the pipe. If there's no out pipe, just drop it. // Push the message into the pipe. If there's no out pipe, just drop it.
if (current_out) { if (current_out) {
bool ok = current_out->write (msg_); bool ok = current_out->write (msg_);
zmq_assert (ok); if (unlikely (!ok))
if (!more_out) { current_out = NULL;
else if (!more_out) {
current_out->flush (); current_out->flush ();
current_out = NULL; current_out = NULL;
} }
......
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