]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/CachePeers.cc
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
10 #include "CachePeers.h"
11 #include "SquidConfig.h"
16 CachePeers::nextPeerToPing(const size_t pollIndex
)
20 // Remember the number of polls to keep shifting each poll starting point,
21 // to avoid always polling the same group of peers before other peers and
22 // risk overloading that first group with requests.
26 // subtract 1 to set the very first pos to zero
27 const auto pos
= (peerPolls_
- 1 + pollIndex
) % size();
33 CachePeers::remove(CachePeer
* const peer
)
35 const auto pos
= std::find_if(storage
.begin(), storage
.end(), [&](const auto &storePeer
) {
36 return storePeer
.get() == peer
;
38 Assure(pos
!= storage
.end());
48 static const CachePeers empty
;
53 DeleteConfigured(CachePeer
* const peer
)
56 Config
.peers
->remove(peer
);