Skip to content

Commit 954470b

Browse files
committed
Problem: ZMQ_STREAM cannot disconnect when SNDHWM is reached
Solution: defer HWM check to the second frame in stream_t::xsend
1 parent 900a548 commit 954470b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/stream.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ int zmq::stream_t::xsend (msg_t *msg_)
7979
_current_out = out_pipe->pipe;
8080
if (!_current_out->check_write ()) {
8181
out_pipe->active = false;
82-
_current_out = NULL;
83-
errno = EAGAIN;
84-
return -1;
8582
}
8683
} else {
8784
errno = EHOSTUNREACH;
@@ -119,6 +116,11 @@ int zmq::stream_t::xsend (msg_t *msg_)
119116
_current_out = NULL;
120117
return 0;
121118
}
119+
if (!_current_out->check_write()) {
120+
_more_out = true;
121+
errno = EAGAIN;
122+
return -1;
123+
}
122124
const bool ok = _current_out->write (msg_);
123125
if (likely (ok))
124126
_current_out->flush ();

0 commit comments

Comments
 (0)