From c53fb6b23ad801f51c92bb0cece6ce5ec184aca2 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 25 Mar 2019 17:11:22 +0100 Subject: [PATCH] dnsdist: Downstream failures only count for fresh TCP connections --- pdns/dnsdist-tcp.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 6a580a05c..f6f59b5ab 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -880,12 +880,15 @@ static void handleDownstreamIOCallback(int fd, FDMultiplexer::funcparam_t& param Let's just drop the connection */ vinfolog("Got an exception while handling (%s backend) TCP query from %s: %s", (state->d_lastIOState == IOState::NeedRead ? "reading from" : "writing to"), state->d_ci.remote.toStringWithPort(), e.what()); - /* remove this FD from the IO multiplexer */ - ++state->d_downstreamFailures; + /* don't increase this counter when reusing connections */ + if (state->d_freshDownstreamConnection) { + ++state->d_downstreamFailures; + } if (state->d_outstanding && state->d_ds != nullptr) { --state->d_ds->outstanding; state->d_outstanding = false; } + /* remove this FD from the IO multiplexer */ iostate = IOState::Done; connectionDied = true; } -- 2.40.0