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

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Martin Sustrik 2011-09-28 08:03:14 +02:00
parent d726120e60
commit 8485a5e5a4
2 changed files with 7 additions and 4 deletions

View File

@ -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.
if (current_out) {
bool ok = current_out->write (msg_);
zmq_assert (ok);
if (!more_out) {
if (unlikely (!ok))
current_out = NULL;
else if (!more_out) {
current_out->flush ();
current_out = NULL;
}

View File

@ -22,6 +22,7 @@
#include "pipe.hpp"
#include "wire.hpp"
#include "random.hpp"
#include "likely.hpp"
#include "err.hpp"
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_)
// Push the message into the pipe. If there's no out pipe, just drop it.
if (current_out) {
bool ok = current_out->write (msg_);
zmq_assert (ok);
if (!more_out) {
if (unlikely (!ok))
current_out = NULL;
else if (!more_out) {
current_out->flush ();
current_out = NULL;
}