From 55d8957d53341ad7b14f7be3a121b756343db170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Staffan=20Gim=C3=A5ker?= Date: Thu, 16 Feb 2012 14:49:47 +0100 Subject: Drop subscription messages when reaching the SNDHWM rather than asserting. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/xsub.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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_, -- cgit v1.2.3