From: Remi Gacogne Date: Mon, 25 Mar 2019 16:11:22 +0000 (+0100) Subject: dnsdist: Downstream failures only count for fresh TCP connections X-Git-Tag: dnsdist-1.4.0-alpha1~25^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c53fb6b23ad801f51c92bb0cece6ce5ec184aca2;p=thirdparty%2Fpdns.git dnsdist: Downstream failures only count for fresh TCP connections --- diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 6a580a05ca..f6f59b5abb 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; }