]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Remove unreachable code in HTTP/2 connections cleanup
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 28 Oct 2021 08:44:49 +0000 (10:44 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 8 Nov 2021 09:26:11 +0000 (10:26 +0100)
Reported by Coverity (CID 373724).

pdns/dnsdistdist/dnsdist-nghttp2.cc
pdns/dnsdistdist/dnsdist-tcp-downstream.cc

index a059f462a004bf7e8678243236219e13fabf1288..e7ac86f64cbababb074de8905b587f9140d3ad1f 100644 (file)
@@ -933,9 +933,8 @@ void DownstreamDoHConnectionsManager::cleanupClosedConnections(struct timeval no
       if ((*connIt)->isUsable()) {
         ++connIt;
       }
-      else {
-        connIt = dsIt->second.erase(connIt);
-      }
+
+      connIt = dsIt->second.erase(connIt);
     }
 
     if (!dsIt->second.empty()) {
@@ -988,8 +987,7 @@ std::shared_ptr<DoHConnectionToBackend> DownstreamDoHConnectionsManager::getConn
           return entry;
         }
 
-        /* otherwise let's try the next one, if any */
-        ++listIt;
+        listIt = list.erase(listIt);
       }
     }
   }
index 30a065441b0ce1c9c9b5b3f05b90a946e6fd111b..acf55d724950508986cb19252906403abd0f7461 100644 (file)
@@ -805,13 +805,8 @@ std::shared_ptr<TCPConnectionToBackend> DownstreamConnectionsManager::getConnect
           ++ds->tcpReusedConnections;
           return entry;
         }
-        else {
-          listIt = list.erase(listIt);
-          continue;
-        }
 
-        /* otherwise let's try the next one, if any */
-        ++listIt;
+        listIt = list.erase(listIt);
       }
     }
   }
@@ -858,9 +853,8 @@ void DownstreamConnectionsManager::cleanupClosedTCPConnections(struct timeval no
       if ((*connIt)->isUsable()) {
         ++connIt;
       }
-      else {
-        connIt = dsIt->second.erase(connIt);
-      }
+
+      connIt = dsIt->second.erase(connIt);
     }
 
     if (!dsIt->second.empty()) {