9#ifndef SQUID_SRC_RESOLVEDPEERS_H
10#define SQUID_SRC_RESOLVEDPEERS_H
39 typedef std::vector<ResolvedPeerPath>
Paths;
90 typedef std::pair<Paths::iterator, bool>
Finding;
95 Paths::iterator
start();
131 explicit operator bool()
const {
return static_cast<bool>(
connection_); }
142 void print(std::ostream &)
const;
146 static constexpr auto npos = std::numeric_limits<size_type>::max();
#define MEMPROXY_CLASS(CLASS)
#define RefCountable
The locking interface for use on Reference-Counted classes.
std::ostream & operator<<(std::ostream &, const ResolvedPeers &)
summarized ResolvedPeers (for debugging)
PeerConnectionPointer(std::nullptr_t)
implicit nullptr conversion
Comm::ConnectionPointer connection_
half-baked, open, failed, or closed Comm::Connection (or nil)
void finalize(const Comm::ConnectionPointer &conn)
upgrade stored peer selection details with a matching actual connection
Comm::Connection * operator->() const
void print(std::ostream &) const
debugging dump
PeerConnectionPointer(const Comm::ConnectionPointer &conn, const size_type pos)
PeerConnectionPointer()=default
static constexpr auto npos
non-existent position for nil connection
size_type position_
ResolvedPeers-maintained membership index (or npos)
ResolvedPeers::size_type size_type
Comm::Connection & operator*() const
Comm::ConnectionPointer connection
(the address of) a path
ResolvedPeerPath(const Comm::ConnectionPointer &conn)
bool available
whether this path may be used (i.e., has not been tried already)
Finding makeFinding(const Paths::iterator &found, bool foundOther)
finalizes the iterator part of the given preliminary find*() result
Paths paths_
resolved addresses in (peer, family) order
PeerConnectionPointer extractFront()
extracts and returns the first queued address
bool doneWith(const Finding &findings) const
std::vector< ResolvedPeerPath > Paths
bool haveSpare(const Comm::Connection ¤tPeer)
whether extractSpare() would return a non-nil path right now
Finding findPrime(const Comm::Connection ¤tPeer)
void increaseAvailability()
increments the number of available paths
Finding findSpare(const Comm::Connection ¤tPeer)
size_type availablePaths
the total number of currently available elements in paths_
static int ConnectionFamily(const Comm::Connection &conn)
The protocol family of the given path, AF_INET or AF_INET6.
bool doneWithPrimes(const Comm::Connection ¤tPeer)
whether extractPrime() returns and will continue to return nil
std::pair< Paths::iterator, bool > Finding
bool doneWithPeer(const Comm::Connection ¤tPeer)
whether doneWithPrimes() and doneWithSpares() are true for currentPeer
void reinstatePath(const PeerConnectionPointer &)
size_type size() const
the current number of candidate paths
PeerConnectionPointer extractFound(const char *description, const Paths::iterator &found)
convenience method to finish a successful extract*() call
Paths::size_type size_type
PeerConnectionPointer extractSpare(const Comm::Connection ¤tPeer)
RefCount< ResolvedPeers > Pointer
bool notificationPending
whether HappyConnOpener::noteCandidatesChange() is scheduled to fire
void decreaseAvailability()
decrements the number of available paths
bool empty() const
whether we lack any known candidate paths
bool destinationsFinalized
whether all of the available candidate paths received from DNS
void addPath(const Comm::ConnectionPointer &)
add a candidate path to try after all the existing paths
Finding findPeer(const Comm::Connection ¤tPeer)
PeerConnectionPointer extractPrime(const Comm::Connection ¤tPeer)
bool doneWithSpares(const Comm::Connection ¤tPeer)
whether extractSpare() returns and will continue to return nil