summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStaffan Gimåker <staffan@spotify.com>2012-02-16 14:49:47 +0100
committerMartin Sustrik <sustrik@250bpm.com>2012-02-17 10:19:26 +0900
commit55d8957d53341ad7b14f7be3a121b756343db170 (patch)
tree770481a315f2a0f4d36b136cd53cccc0e14fe08c /src
parentee27872030b5f0aa55ed161099004d38c8dd7b5d (diff)
Drop subscription messages when reaching the SNDHWM rather than asserting.
This matches the behaviour of zmq_setsockopt(ZMQ_SUBSCRIBE, ...), which also silently drops subscription messages if the SNDHWM is reached. Signed-off-by: Staffan Gimåker <staffan@spotify.com>
Diffstat (limited to 'src')
-rw-r--r--src/xsub.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/xsub.cpp b/src/xsub.cpp
index e9ae87b..add5ba9 100644
--- a/src/xsub.cpp
+++ b/src/xsub.cpp
@@ -218,7 +218,13 @@ void xs::xsub_t::send_subscription (unsigned char *data_, size_t size_,
// Send it to the pipe.
bool sent = pipe->write (&msg);
- xs_assert (sent);
+
+ // If we reached the SNDHWM, and thus cannot send the subscription, drop
+ // the subscription message instead. This matches the behaviour of
+ // xs_setsockopt(XS_SUBSCRIBE, ...), which also drops subscriptions
+ // when the SNDHWM is reached.
+ if (!sent)
+ msg.close ();
}
xs::xsub_session_t::xsub_session_t (io_thread_t *io_thread_, bool connect_,