Commit be23e699 authored by Joe Eli McIlvain's avatar Joe Eli McIlvain

Merge pull request #1314 from topher200/master

Close messages that failed to send
parents 94b0ad3e 866a0465
...@@ -246,14 +246,18 @@ int zmq::router_t::xsend (msg_t *msg_) ...@@ -246,14 +246,18 @@ int zmq::router_t::xsend (msg_t *msg_)
} }
bool ok = current_out->write (msg_); bool ok = current_out->write (msg_);
if (unlikely (!ok)) if (unlikely (!ok)) {
// Message failed to send - we must close it ourselves.
int rc = msg_->close ();
errno_assert (rc == 0);
current_out = NULL; current_out = NULL;
else } else {
if (!more_out) { if (!more_out) {
current_out->flush (); current_out->flush ();
current_out = NULL; current_out = NULL;
} }
} }
}
else { else {
int rc = msg_->close (); int rc = msg_->close ();
errno_assert (rc == 0); errno_assert (rc == 0);
......
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