Problem with ZMQ_ROUTER_MANDATORY option when peer lost

indention

Revert "indention"

This reverts commit a6e7e192ac2d089ac9f7dc0d31d4b1fd10de982e.

indention

indention

Fix Failure in tests

Check both pipe full and pipe close
This commit is contained in:
Reza Ebrahimi
2017-02-24 13:07:06 +03:30
parent 995a41b5a3
commit 06740b5d8c
3 changed files with 38 additions and 7 deletions

View File

@@ -212,15 +212,30 @@ int zmq::router_t::xsend (msg_t *msg_)
if (it != outpipes.end ()) {
current_out = it->second.pipe;
if (!current_out->check_write ()) {
// Check whether pipe is full or not
if (!current_out->check_hwm()) {
it->second.active = false;
current_out = NULL;
if (mandatory) {
more_out = false;
errno = EAGAIN;
return -1;
}
}
// Check whether pipe is closed or not
else
if (!current_out->check_write()) {
it->second.active = false;
current_out = NULL;
if (mandatory) {
more_out = false;
errno = EHOSTUNREACH;
return -1;
}
}
}
else
if (mandatory) {