summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-03-03 12:37:11 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-03-03 12:37:11 +0100
commit184bdb8e2bb6fe252af1bf4dd16d1c9ed8892f7a (patch)
treecebd9af846b514fe278c22332134808765cbfd2f /src
parent97add1ec2f75858ee950fa19b266396147efa224 (diff)
Bug caused by interaction of REQ/REP routing and HWM fixed.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src')
-rw-r--r--src/xrep.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/xrep.cpp b/src/xrep.cpp
index 422b0c0..5406a0b 100644
--- a/src/xrep.cpp
+++ b/src/xrep.cpp
@@ -177,8 +177,22 @@ int zmq::xrep_t::xsend (zmq_msg_t *msg_, int flags_)
blob_t identity ((unsigned char*) zmq_msg_data (msg_),
zmq_msg_size (msg_));
outpipes_t::iterator it = outpipes.find (identity);
- if (it != outpipes.end ())
+
+ if (it != outpipes.end ()) {
current_out = it->second.writer;
+ zmq_msg_t empty;
+ int rc = zmq_msg_init (&empty);
+ zmq_assert (rc == 0);
+ if (!current_out->check_write (&empty)) {
+ rc = zmq_msg_close (&empty);
+ zmq_assert (rc == 0);
+ it->second.active = false;
+ errno = EAGAIN;
+ return -1;
+ }
+ rc = zmq_msg_close (&empty);
+ zmq_assert (rc == 0);
+ }
}
int rc = zmq_msg_close (msg_);