From d1373792f7888f312cd7286fdf524a0bfe124846 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 23 Jun 2011 07:57:47 +0200 Subject: Outstanding requests dropped when requester dies (issue 190) So far the requests in req/rep pattern were delivered to and processed by worker even though the original requester was dead. Thus, the worker processing replies with noone to deliver results to. This optimisation drops requests in two situations: 1. Queued inbound requests in XREP socket when peer disconnects. 2. Queued outbound requests in XREQ when socket is closed. Signed-off-by: Martin Sustrik --- src/xreq.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/xreq.cpp') diff --git a/src/xreq.cpp b/src/xreq.cpp index 2371a34..85e2238 100644 --- a/src/xreq.cpp +++ b/src/xreq.cpp @@ -26,6 +26,10 @@ zmq::xreq_t::xreq_t (class ctx_t *parent_, uint32_t tid_) : socket_base_t (parent_, tid_) { options.type = ZMQ_XREQ; + + // If the socket is closing we can drop all the outbound requests. There'll + // be noone to receive the replies anyway. + options.delay_on_close = false; } zmq::xreq_t::~xreq_t () -- cgit v1.2.3