]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add local-end details to pconn matching if set by route selection
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 2 Oct 2010 16:17:14 +0000 (05:17 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 2 Oct 2010 16:17:14 +0000 (05:17 +1300)
src/pconn.cc

index e49136d56818039c1da44470db22f5f81c63f849..8082d2aff8377ac735fe491592ff29dd07fd6597 100644 (file)
@@ -76,8 +76,21 @@ int
 IdleConnList::findIndex(const Comm::ConnectionPointer &conn)
 {
     for (int index = nfds - 1; index >= 0; --index) {
-        if (theList[index]->fd == conn->fd)
-            return index;
+
+        // remote IPs dont match.
+        if (conn->remote != theList[index]->remote)
+            continue;
+
+        // local end port is required, but dont match.
+        if (conn->local.GetPort() > 0 && conn->local.GetPort() != theList[index]->local.GetPort())
+            continue;
+
+        // local address is required, but does not match.
+        if (!conn->local.IsAnyAddr() && conn->local != theList[index]->local)
+            continue;
+
+        // finally, a match
+        return index;
     }
 
     return -1;