From: Eduard Bagdasaryan Date: Thu, 21 Nov 2019 08:19:47 +0000 (+0000) Subject: Happy Eyeballs: Do not wait for already exhausted spares (#509) X-Git-Tag: SQUID_5_0_1~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6185ad8c66728a257e0c49c5eb434f33fc3971fd;p=thirdparty%2Fsquid.git Happy Eyeballs: Do not wait for already exhausted spares (#509) ResolvedPeers::findSpareOrNextPeer() never returned the next peer. That bug made doneWithSpares() return false when the next peer was present, even though no spares were expected. The exact effects of this bug are not known, but wrong false doneWithSpares() outcome may force Squid to wait for more spare addresses that would never come, possibly slowing down transactions. --- diff --git a/src/ResolvedPeers.cc b/src/ResolvedPeers.cc index 4cfbf20505..f7620134e2 100644 --- a/src/ResolvedPeers.cc +++ b/src/ResolvedPeers.cc @@ -65,14 +65,11 @@ ResolvedPeers::findSpareOrNextPeer(const Comm::Connection ¤tPeer) const auto familyToAvoid = ConnectionFamily(currentPeer); // Optimization: Also stop at the first mismatching peer because all // same-peer paths are grouped together. - auto found = std::find_if(paths_.begin(), paths_.end(), + return std::find_if(paths_.begin(), paths_.end(), [peerToMatch, familyToAvoid](const Comm::ConnectionPointer &conn) { return peerToMatch != conn->getPeer() || familyToAvoid != ConnectionFamily(*conn); }); - if (found != paths_.end() && peerToMatch == (*found)->getPeer()) - return found; - return paths_.end(); } Comm::ConnectionPointer