]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Do not pretend that a connection will be reusable when it's dead
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 21 Jun 2022 15:27:05 +0000 (17:27 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 24 Jun 2022 12:13:53 +0000 (14:13 +0200)
By remember that a connection is no longer usable when we notice that,
we prevent a case where we could pretend that it will be usable when
it has finished processing the current queries and responses, which
is not true.

pdns/dnsdistdist/dnsdist-tcp-downstream.hh

index c257e0c1245d837d6356ab6797c3ae589db06d63..939e6a041ae15d95b20f542cadb8127e53ef5b7a 100644 (file)
@@ -25,13 +25,19 @@ public:
   }
 
   /* whether the underlying socket has been closed under our feet, basically */
-  bool isUsable() const
+  bool isUsable()
   {
     if (!d_handler) {
+      d_connectionDied = true;
       return false;
     }
 
-    return d_handler->isUsable();
+    if (d_handler->isUsable()) {
+      return true;
+    }
+
+    d_connectionDied = true;
+    return false;
   }
 
   const std::shared_ptr<DownstreamState>& getDS() const