]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Downstream failures only count for fresh TCP connections
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 25 Mar 2019 16:11:22 +0000 (17:11 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 4 Apr 2019 09:54:05 +0000 (11:54 +0200)
pdns/dnsdist-tcp.cc

index 6a580a05ca3b0a3bba99b679a2231147dbb93293..f6f59b5abb55585d9768273c7eb6cf66958a1a2a 100644 (file)
@@ -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;
   }