From: Amos Jeffries Date: Sat, 2 Oct 2010 16:17:14 +0000 (+1300) Subject: Add local-end details to pconn matching if set by route selection X-Git-Tag: take08~55^2~124^2~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=55670e10c59267845b8bc476b1566cbe4dad5baf;p=thirdparty%2Fsquid.git Add local-end details to pconn matching if set by route selection --- diff --git a/src/pconn.cc b/src/pconn.cc index e49136d568..8082d2aff8 100644 --- a/src/pconn.cc +++ b/src/pconn.cc @@ -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;