mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-27 07:31:03 +08:00
returns -1 with EAGAIN when mandatory is set and pipe is full
This commit is contained in:
parent
2a7b219f07
commit
a0cecc718d
@ -159,21 +159,21 @@ int zmq::router_t::xsend (msg_t *msg_)
|
||||
// router_mandatory is set.
|
||||
blob_t identity ((unsigned char*) msg_->data (), msg_->size ());
|
||||
outpipes_t::iterator it = outpipes.find (identity);
|
||||
bool unreach = false;
|
||||
|
||||
if (it != outpipes.end ()) {
|
||||
current_out = it->second.pipe;
|
||||
if (!current_out->check_write ()) {
|
||||
it->second.active = false;
|
||||
current_out = NULL;
|
||||
unreach = mandatory ? true: false;
|
||||
if (mandatory) {
|
||||
more_out = false;
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (mandatory)
|
||||
unreach = true;
|
||||
|
||||
if (unreach) {
|
||||
if (mandatory) {
|
||||
more_out = false;
|
||||
errno = EHOSTUNREACH;
|
||||
return -1;
|
||||
|
@ -71,7 +71,7 @@ int main (void)
|
||||
assert (rc == 0);
|
||||
|
||||
// wait until connect
|
||||
zmq_sleep (1);
|
||||
zmq_sleep (1);
|
||||
|
||||
// make it full and check that it fails
|
||||
rc = zmq_send (sa, "X", 1, ZMQ_SNDMORE);
|
||||
@ -79,18 +79,17 @@ int main (void)
|
||||
rc = zmq_send (sa, "DATA1", 5, 0);
|
||||
assert (rc == 5);
|
||||
|
||||
|
||||
rc = zmq_send (sa, "X", 1, ZMQ_SNDMORE);
|
||||
rc = zmq_send (sa, "X", 1, ZMQ_SNDMORE | ZMQ_DONTWAIT);
|
||||
if (rc == 1) {
|
||||
// the first frame has been sent
|
||||
rc = zmq_send (sa, "DATA2", 5, 0);
|
||||
assert (rc == 5);
|
||||
|
||||
// send more
|
||||
rc = zmq_send (sa, "X", 1, ZMQ_SNDMORE);
|
||||
rc = zmq_send (sa, "X", 1, ZMQ_SNDMORE | ZMQ_DONTWAIT);
|
||||
}
|
||||
|
||||
assert (rc == -1 && errno == EHOSTUNREACH);
|
||||
assert (rc == -1 && errno == EAGAIN);
|
||||
|
||||
|
||||
rc = zmq_close (sa);
|
||||
|
Loading…
x
Reference in New Issue
Block a user