mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-22 10:25:52 +01:00
Merge pull request #2354 from bluca/fix_pipe
Problem: router pipe can block forever
This commit is contained in:
commit
07d904a2f8
@ -213,25 +213,18 @@ int zmq::router_t::xsend (msg_t *msg_)
|
|||||||
if (it != outpipes.end ()) {
|
if (it != outpipes.end ()) {
|
||||||
current_out = it->second.pipe;
|
current_out = it->second.pipe;
|
||||||
|
|
||||||
// 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
|
// Check whether pipe is closed or not
|
||||||
else
|
|
||||||
if (!current_out->check_write()) {
|
if (!current_out->check_write()) {
|
||||||
|
// Check whether pipe is full or not
|
||||||
|
bool pipe_full = !current_out->check_hwm ();
|
||||||
it->second.active = false;
|
it->second.active = false;
|
||||||
current_out = NULL;
|
current_out = NULL;
|
||||||
|
|
||||||
if (mandatory) {
|
if (mandatory) {
|
||||||
more_out = false;
|
more_out = false;
|
||||||
|
if (pipe_full)
|
||||||
|
errno = EAGAIN;
|
||||||
|
else
|
||||||
errno = EHOSTUNREACH;
|
errno = EHOSTUNREACH;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user