diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-06-23 07:57:47 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-06-23 07:57:47 +0200 |
commit | d1373792f7888f312cd7286fdf524a0bfe124846 (patch) | |
tree | 046c7a5473b43b50be02ef34705e2a45e753c51c /src/xreq.cpp | |
parent | 12532c7940f23fcb3cd46208c141d47647e76231 (diff) |
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 <sustrik@250bpm.com>
Diffstat (limited to 'src/xreq.cpp')
-rw-r--r-- | src/xreq.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
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 () |