#include <ResolvedPeers.h>


| Public Types | |
| typedef std::vector< ResolvedPeerPath > | Paths | 
| using | size_type = Paths::size_type | 
| typedef RefCount< ResolvedPeers > | Pointer | 
| Public Member Functions | |
| void * | operator new (size_t byteCount) | 
| void | operator delete (void *address) | 
| ResolvedPeers () | |
| bool | empty () const | 
| whether we lack any known candidate paths  More... | |
| void | addPath (const Comm::ConnectionPointer &) | 
| add a candidate path to try after all the existing paths  More... | |
| void | reinstatePath (const PeerConnectionPointer &) | 
| PeerConnectionPointer | extractFront () | 
| extracts and returns the first queued address  More... | |
| PeerConnectionPointer | extractPrime (const Comm::Connection ¤tPeer) | 
| PeerConnectionPointer | extractSpare (const Comm::Connection ¤tPeer) | 
| bool | haveSpare (const Comm::Connection ¤tPeer) | 
| whether extractSpare() would return a non-nil path right now  More... | |
| bool | doneWithPrimes (const Comm::Connection ¤tPeer) | 
| whether extractPrime() returns and will continue to return nil  More... | |
| bool | doneWithSpares (const Comm::Connection ¤tPeer) | 
| whether extractSpare() returns and will continue to return nil  More... | |
| bool | doneWithPeer (const Comm::Connection ¤tPeer) | 
| whether doneWithPrimes() and doneWithSpares() are true for currentPeer  More... | |
| size_type | size () const | 
| the current number of candidate paths  More... | |
| Static Public Member Functions | |
| static int | UseCount () | 
| Public Attributes | |
| bool | destinationsFinalized = false | 
| whether all of the available candidate paths received from DNS  More... | |
| bool | notificationPending = false | 
| whether HappyConnOpener::noteCandidatesChange() is scheduled to fire  More... | |
| Private Types | |
| typedef std::pair< Paths::iterator, bool > | Finding | 
| Private Member Functions | |
| Paths::iterator | start () | 
| Finding | findSpare (const Comm::Connection ¤tPeer) | 
| Finding | findPrime (const Comm::Connection ¤tPeer) | 
| Finding | findPeer (const Comm::Connection ¤tPeer) | 
| PeerConnectionPointer | extractFound (const char *description, const Paths::iterator &found) | 
| convenience method to finish a successful extract*() call  More... | |
| Finding | makeFinding (const Paths::iterator &found, bool foundOther) | 
| finalizes the iterator part of the given preliminary find*() result  More... | |
| bool | doneWith (const Finding &findings) const | 
| void | increaseAvailability () | 
| increments the number of available paths  More... | |
| void | decreaseAvailability () | 
| decrements the number of available paths  More... | |
| Static Private Member Functions | |
| static Mem::AllocatorProxy & | Pool () | 
| static int | ConnectionFamily (const Comm::Connection &conn) | 
| The protocol family of the given path, AF_INET or AF_INET6.  More... | |
| Private Attributes | |
| Paths | paths_ | 
| resolved addresses in (peer, family) order  More... | |
| size_type | pathsToSkip = 0 | 
| size_type | availablePaths = 0 | 
| the total number of currently available elements in paths_  More... | |
Detailed Description
cache_peer and origin server addresses (a.k.a. paths) selected and resolved by the peering code
Definition at line 33 of file ResolvedPeers.h.
Member Typedef Documentation
◆ Finding
| 
 | private | 
A find*() result: An iterator of the found path (or paths_.end()) and whether the "other" path was found instead.
Definition at line 90 of file ResolvedPeers.h.
◆ Paths
Definition at line 35 of file ResolvedPeers.h.
◆ Pointer
| typedef RefCount<ResolvedPeers> ResolvedPeers::Pointer | 
Definition at line 41 of file ResolvedPeers.h.
◆ size_type
| using ResolvedPeers::size_type = Paths::size_type | 
Definition at line 40 of file ResolvedPeers.h.
Constructor & Destructor Documentation
◆ ResolvedPeers()
| ResolvedPeers::ResolvedPeers | ( | ) | 
Definition at line 18 of file ResolvedPeers.cc.
References Config, SquidConfig::forward_max_tries, and paths_.
Member Function Documentation
◆ addPath()
| void ResolvedPeers::addPath | ( | const Comm::ConnectionPointer & | path | ) | 
Definition at line 48 of file ResolvedPeers.cc.
References increaseAvailability(), Must, and paths_.
Referenced by FwdState::noteDestination(), and TunnelStateData::noteDestination().
◆ ConnectionFamily()
| 
 | staticprivate | 
Definition at line 199 of file ResolvedPeers.cc.
References Ip::Address::isIPv4(), and Comm::Connection::remote.
Referenced by findPrime(), and findSpare().
◆ decreaseAvailability()
| 
 | private | 
Definition at line 214 of file ResolvedPeers.cc.
References assert, and availablePaths.
Referenced by extractFound().
◆ doneWith()
| 
 | private | 
whether paths_ have no (and will have no) Xs for the current peer based on the given findX(current peer) result
Definition at line 169 of file ResolvedPeers.cc.
References destinationsFinalized, and paths_.
Referenced by doneWithPeer(), doneWithPrimes(), and doneWithSpares().
◆ doneWithPeer()
| bool ResolvedPeers::doneWithPeer | ( | const Comm::Connection & | currentPeer | ) | 
Definition at line 193 of file ResolvedPeers.cc.
References doneWith(), and findPeer().
Referenced by HappyConnOpener::checkForNewConnection().
◆ doneWithPrimes()
| bool ResolvedPeers::doneWithPrimes | ( | const Comm::Connection & | currentPeer | ) | 
Definition at line 187 of file ResolvedPeers.cc.
References doneWith(), and findPrime().
Referenced by HappyConnOpener::updateSpareWaitAfterPrimeFailure().
◆ doneWithSpares()
| bool ResolvedPeers::doneWithSpares | ( | const Comm::Connection & | currentPeer | ) | 
Definition at line 181 of file ResolvedPeers.cc.
References doneWith(), and findSpare().
Referenced by HappyConnOpener::checkForNewConnection(), and HappyConnOpener::maybeGivePrimeItsChance().
◆ empty()
| 
 | inline | 
Definition at line 46 of file ResolvedPeers.h.
References availablePaths.
Referenced by FwdState::connectStart(), HappyConnOpener::doneAll(), extractFront(), HappyConnOpener::maybeOpenPrimeConnection(), HappyConnOpener::maybeOpenSpareConnection(), FwdState::noteDestination(), TunnelStateData::noteDestination(), operator<<(), FwdState::reforward(), TunnelStateData::retryOrBail(), TunnelStateData::startConnecting(), and FwdState::useDestinations().
◆ extractFound()
| 
 | private | 
Definition at line 143 of file ResolvedPeers.cc.
References assert, debugs, decreaseAvailability(), paths_, and pathsToSkip.
Referenced by extractFront(), extractPrime(), and extractSpare().
◆ extractFront()
| PeerConnectionPointer ResolvedPeers::extractFront | ( | ) | 
Definition at line 113 of file ResolvedPeers.cc.
References empty(), extractFound(), Must, and start().
Referenced by HappyConnOpener::maybeOpenPrimeConnection().
◆ extractPrime()
| PeerConnectionPointer ResolvedPeers::extractPrime | ( | const Comm::Connection & | currentPeer | ) | 
extracts and returns the first same-peer same-family address
- Returns
- nil if it cannot find the requested address
Definition at line 120 of file ResolvedPeers.cc.
References debugs, extractFound(), findPrime(), and paths_.
Referenced by HappyConnOpener::maybeOpenPrimeConnection().
◆ extractSpare()
| PeerConnectionPointer ResolvedPeers::extractSpare | ( | const Comm::Connection & | currentPeer | ) | 
extracts and returns the first same-peer different-family address
- Returns
- nil if it cannot find the requested address
Definition at line 131 of file ResolvedPeers.cc.
References debugs, extractFound(), findSpare(), and paths_.
Referenced by HappyConnOpener::maybeOpenSpareConnection(), and HappyConnOpener::noteSpareAllowance().
◆ findPeer()
| 
 | private | 
- Returns
- the first available same-peer Finding or <end,...>
Definition at line 104 of file ResolvedPeers.cc.
References Comm::Connection::getPeer(), makeFinding(), paths_, and start().
Referenced by doneWithPeer().
◆ findPrime()
| 
 | private | 
- Returns
- the first available same-peer same-family Finding or <end,...>
Definition at line 72 of file ResolvedPeers.cc.
References ConnectionFamily(), Comm::Connection::getPeer(), makeFinding(), paths_, and start().
Referenced by doneWithPrimes(), and extractPrime().
◆ findSpare()
| 
 | private | 
- Returns
- the first available same-peer different-family Finding or <end,...>
Definition at line 83 of file ResolvedPeers.cc.
References ConnectionFamily(), Comm::Connection::getPeer(), makeFinding(), paths_, and start().
Referenced by doneWithSpares(), extractSpare(), and haveSpare().
◆ haveSpare()
| bool ResolvedPeers::haveSpare | ( | const Comm::Connection & | currentPeer | ) | 
Definition at line 161 of file ResolvedPeers.cc.
References findSpare(), and paths_.
Referenced by HappyConnOpener::maybeOpenSpareConnection().
◆ increaseAvailability()
| 
 | private | 
Definition at line 206 of file ResolvedPeers.cc.
References assert, availablePaths, and paths_.
Referenced by addPath(), and reinstatePath().
◆ makeFinding()
| 
 | private | 
Definition at line 65 of file ResolvedPeers.cc.
References paths_.
Referenced by findPeer(), findPrime(), and findSpare().
◆ operator delete()
| 
 | inline | 
Definition at line 35 of file ResolvedPeers.h.
◆ operator new()
| 
 | inline | 
Definition at line 35 of file ResolvedPeers.h.
◆ Pool()
| 
 | inlinestaticprivate | 
Definition at line 35 of file ResolvedPeers.h.
◆ reinstatePath()
| void ResolvedPeers::reinstatePath | ( | const PeerConnectionPointer & | path | ) | 
makes the previously extracted path available for extraction at its original position
Definition at line 25 of file ResolvedPeers.cc.
References assert, debugs, increaseAvailability(), Must, paths_, pathsToSkip, and PeerConnectionPointer::position_.
Referenced by HappyConnOpener::cancelAttempt(), and FwdState::reactToZeroSizeObject().
◆ size()
| 
 | inline | 
Definition at line 79 of file ResolvedPeers.h.
References availablePaths.
Referenced by operator<<().
◆ start()
| 
 | private | 
- Returns
- the beginning iterator for any available-path search
Definition at line 57 of file ResolvedPeers.cc.
References Must, paths_, and pathsToSkip.
Referenced by extractFront(), findPeer(), findPrime(), and findSpare().
◆ UseCount()
| 
 | inlinestatic | 
Definition at line 35 of file ResolvedPeers.h.
Member Data Documentation
◆ availablePaths
| 
 | private | 
Definition at line 115 of file ResolvedPeers.h.
Referenced by decreaseAvailability(), empty(), increaseAvailability(), and size().
◆ destinationsFinalized
| bool ResolvedPeers::destinationsFinalized = false | 
Definition at line 82 of file ResolvedPeers.h.
Referenced by HappyConnOpener::doneAll(), doneWith(), FwdState::noteDestinationsEnd(), TunnelStateData::noteDestinationsEnd(), and operator<<().
◆ notificationPending
| bool ResolvedPeers::notificationPending = false | 
Definition at line 85 of file ResolvedPeers.h.
Referenced by FwdState::connectStart(), HappyConnOpener::noteCandidatesChange(), FwdState::notifyConnOpener(), TunnelStateData::notifyConnOpener(), HappyConnOpener::start(), and TunnelStateData::startConnecting().
◆ paths_
| 
 | private | 
Definition at line 107 of file ResolvedPeers.h.
Referenced by addPath(), doneWith(), extractFound(), extractPrime(), extractSpare(), findPeer(), findPrime(), findSpare(), haveSpare(), increaseAvailability(), makeFinding(), reinstatePath(), ResolvedPeers(), and start().
◆ pathsToSkip
| 
 | private | 
the number of leading paths_ elements that are all currently unavailable i.e. the size of the front paths_ segment comprised of unavailable items i.e. the position of the first available path (or paths_.size())
Definition at line 112 of file ResolvedPeers.h.
Referenced by extractFound(), reinstatePath(), and start().
The documentation for this class was generated from the following files:
- src/ResolvedPeers.h
- src/ResolvedPeers.cc
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products
