From ca8955058c2570df094cc97ed4e0757dc6647fd8 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 17 Apr 2012 07:56:41 +0200 Subject: Discard pending surveys when (X)SURVEYOR socket disappears This is an optimisation. The idea is that when surveyor disappears it makes no sense to process any surveys it have sent. There are two cases handled: - when (X)SURVEYOR socket is closed any unsent outbound messages are discarded - when (X)RESPONDENT detects that its peer have disconnected it drops any unprocessed messages that have been received from it Signed-off-by: Martin Sustrik --- src/xrespondent.cpp | 4 ++++ src/xsurveyor.cpp | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/xrespondent.cpp b/src/xrespondent.cpp index 026fe8d..c16d900 100644 --- a/src/xrespondent.cpp +++ b/src/xrespondent.cpp @@ -36,6 +36,10 @@ xs::xrespondent_t::xrespondent_t (class ctx_t *parent_, uint32_t tid_, { options.type = XS_XRESPONDENT; + // If the connection disappears it makes no sense to read any more surveys + // from it. The responses will be unroutable anyway. + options.delay_on_disconnect = false; + prefetched_msg.init (); } diff --git a/src/xsurveyor.cpp b/src/xsurveyor.cpp index 4265437..985b6d8 100644 --- a/src/xsurveyor.cpp +++ b/src/xsurveyor.cpp @@ -26,6 +26,10 @@ xs::xsurveyor_t::xsurveyor_t (class ctx_t *parent_, uint32_t tid_, int sid_) : socket_base_t (parent_, tid_, sid_) { options.type = XS_XSURVEYOR; + + // When the XSURVEYOR socket is close it makes no sense to send any pending + // surveys. The responses will be unroutable anyway. + options.delay_on_close = false; } xs::xsurveyor_t::~xsurveyor_t () -- cgit v1.2.3