Created
March 2, 2011 23:00
-
-
Save sustrik/851948 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/xrep.cpp b/src/xrep.cpp | |
index 422b0c0..84d193c 100644 | |
--- a/src/xrep.cpp | |
+++ b/src/xrep.cpp | |
@@ -177,8 +177,21 @@ 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_); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment