summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-12-17 23:42:45 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-12-17 23:42:45 +0100
commit3fbe8ac3c3aaec777c305de8fbdc0d748c3b14aa (patch)
treedd6ee05efd62dd67736cc5325e8ef876416309a8
parent91fdedf25c4d76b0ec0aeb5d1d9f1c9a1a769447 (diff)
Dont wait for pending subscription commands on shutdown
When (X)SUB socket is being shut down there may be pending outbound subscription commands in the pipes. In such case we want to close the socket immediately instead of waiting for the commands to be sent. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r--src/xsub.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/xsub.cpp b/src/xsub.cpp
index aae2654..454dfb0 100644
--- a/src/xsub.cpp
+++ b/src/xsub.cpp
@@ -30,6 +30,11 @@ zmq::xsub_t::xsub_t (class ctx_t *parent_, uint32_t tid_) :
more (false)
{
options.type = ZMQ_XSUB;
+
+ // When socket is being closed down we don't want to wait till pending
+ // subscription commands are sent to the wire.
+ options.linger = 0;
+
int rc = message.init ();
errno_assert (rc == 0);
}