#include <PeerSelectState.h>

Inheritance diagram for PeerSelector:
Collaboration diagram for PeerSelector:

Public Member Functions

 PeerSelector (PeerSelectionInitiator *)
 ~PeerSelector () override
void noteIp (const Ip::Address &ip) override
 Called when/if nbgethostbyname() discovers a new good IP address. More...
void noteIps (const Dns::CachedIps *ips, const Dns::LookupDetails &details) override
void noteLookup (const Dns::LookupDetails &details) override
const SBuf url () const
PeerSelectionInitiatorinterestedInitiator ()
bool wantsMoreDestinations () const
void handlePath (const Comm::ConnectionPointer &path, FwdServer &fs)
 processes a newly discovered/finalized path More...
void selectMore ()
 a single selection loop iteration: attempts to add more destinations More...
void startPingWaiting ()
 switches into the PING_WAITING state (and associated timeout monitoring) More...
void cancelPingTimeoutMonitoring ()
 terminates ICP ping timeout monitoring More...
virtual void * toCbdata ()=0

Static Public Member Functions

static void HandlePingTimeout (PeerSelector *)
 called when the given selector should stop expecting ICP ping responses More...

Public Attributes

AccessLogEntry::Pointer al
 info for the future access.log entry More...
void * peerCountMcastPeerXXX = nullptr
 a hack to help peerCountMcastPeersStart() More...
ping_data ping

Protected Member Functions

bool selectionAborted ()
void handlePingTimeout ()
void handleIcpReply (CachePeer *, const peer_t, icp_common_t *header)
void handleIcpParentMiss (CachePeer *, icp_common_t *)
void handleHtcpParentMiss (CachePeer *, HtcpReplyData *)
void handleHtcpReply (CachePeer *, const peer_t, HtcpReplyData *)
int checkNetdbDirect ()
void checkAlwaysDirectDone (const Acl::Answer answer)
void checkNeverDirectDone (const Acl::Answer answer)
void selectSomeNeighbor ()
void selectSomeNeighborReplies ()
 Selects a neighbor (parent or sibling) based on ICP/HTCP replies. More...
void selectSomeDirect ()
 Adds a "direct" entry if the request can be forwarded to the origin server. More...
void selectSomeParent ()
void selectAllParents ()
 Adds alive parents. Used as a last resort for never_direct. More...
void selectPinned ()
 Selects a pinned connection if it exists, is valid, and is allowed. More...
void addSelection (CachePeer *, const hier_code)
void resolveSelected ()
 A single DNS resolution loop iteration: Converts selected FwdServer to IPs. More...

Static Protected Attributes

static IRCB HandlePingReply
static ACLCB CheckAlwaysDirectDone
static ACLCB CheckNeverDirectDone

Private Types

typedef CbcPointer< PeerSelectionInitiatorInitiator

Private Member Functions

 CBDATA_CHILD (PeerSelector)
virtual void finalizedInCbdataChild ()=0
 hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More...

Private Attributes

Acl::Answer always_direct
Acl::Answer never_direct
int direct
size_t foundPaths = 0
 number of unique destinations identified so far More...
 a linked list of (unresolved) selected peers More...
Ip::Address first_parent_miss
Ip::Address closest_parent_miss
peer_t hit_type
Initiator initiator_
 recipient of the destinations we select; use interestedInitiator() to access More...
const InstanceId< PeerSelectorid
 unique identification in worker log More...

Detailed Description

Finds peer (including origin server) IPs for forwarding a single request. Gives PeerSelectionInitiator each found destination, in the right order.

Definition at line 59 of file PeerSelectState.h.

Member Typedef Documentation

◆ Initiator

Definition at line 163 of file PeerSelectState.h.

Constructor & Destructor Documentation

◆ PeerSelector()

PeerSelector::PeerSelector ( PeerSelectionInitiator initiator)

Definition at line 1110 of file peer_select.cc.

◆ ~PeerSelector()

Member Function Documentation

◆ addSelection()

void PeerSelector::addSelection ( CachePeer peer,
const hier_code  code 

◆ cancelPingTimeoutMonitoring()

void PeerSelector::cancelPingTimeoutMonitoring ( )

Definition at line 272 of file peer_select.cc.

References PeerSelectorPingMonitor::forget(), and PingMonitor().

Referenced by ~PeerSelector(), and selectMore().


PeerSelector::CBDATA_CHILD ( PeerSelector  )

◆ checkAlwaysDirectDone()

void PeerSelector::checkAlwaysDirectDone ( const Acl::Answer  answer)

if always_direct says YES, do that.

Definition at line 371 of file peer_select.cc.

References ACCESS_ALLOWED, ACCESS_AUTH_REQUIRED, ACCESS_DENIED, ACCESS_DUNNO, acl_checklist, always_direct, DBG_IMPORTANT, debugs, direct, DIRECT_YES, DirectStr, and selectMore().

◆ checkNetdbDirect()

◆ checkNeverDirectDone()

void PeerSelector::checkNeverDirectDone ( const Acl::Answer  answer)

if never_direct says YES, do that.

Definition at line 343 of file peer_select.cc.

References ACCESS_ALLOWED, ACCESS_AUTH_REQUIRED, ACCESS_DENIED, ACCESS_DUNNO, acl_checklist, DBG_IMPORTANT, debugs, direct, DIRECT_NO, DirectStr, never_direct, and selectMore().

◆ finalizedInCbdataChild()

virtual void CbdataParent::finalizedInCbdataChild ( )
privatepure virtualinherited

◆ handleHtcpParentMiss()

◆ handleHtcpReply()

void PeerSelector::handleHtcpReply ( CachePeer p,
const peer_t  type,
HtcpReplyData htcp 

◆ handleIcpParentMiss()

◆ handleIcpReply()

◆ handlePath()

◆ handlePingTimeout()

void PeerSelector::handlePingTimeout ( )

◆ HandlePingTimeout()

void PeerSelector::HandlePingTimeout ( PeerSelector selector)

Definition at line 916 of file peer_select.cc.

References handlePingTimeout().

◆ interestedInitiator()

PeerSelectionInitiator * PeerSelector::interestedInitiator ( )
valid/interested peer initiator or nil

Definition at line 1143 of file peer_select.cc.

References debugs, initiator_, and CbcPointer< Cbc >::valid().

Referenced by handlePath(), resolveSelected(), and selectionAborted().

◆ noteIp()

◆ noteIps()

void PeerSelector::noteIps ( const Dns::CachedIps ips,
const Dns::LookupDetails details 

Called when nbgethostbyname() fully resolves the name. The ips may contain both bad and good IP addresses, but each good IP (if any) is guaranteed to had been previously reported via noteIp(). When no IPs were obtained, ips is nil.

Implements Dns::IpReceiver.

Definition at line 542 of file peer_select.cc.

References FwdServer::_peer, al, FwdServer::code, debugs, ErrorState::dnsError, ERR_DNS_FAIL, Dns::LookupDetails::error, HIER_DIRECT, AnyP::Uri::host(), CachePeer::host, lastError, FwdServer::next, request, resolveSelected(), Http::scServiceUnavailable, selectionAborted(), servers, HttpRequest::url, and CbcPointer< Cbc >::valid().

◆ noteLookup()

void PeerSelector::noteLookup ( const Dns::LookupDetails )

Called when/if nbgethostbyname() completes a single DNS lookup if called, called before all the noteIp() calls for that DNS lookup.

Reimplemented from Dns::IpReceiver.

Definition at line 502 of file peer_select.cc.

References HttpRequest::recordLookup(), request, selectionAborted(), and wantsMoreDestinations().

◆ resolveSelected()

◆ selectAllParents()

void PeerSelector::selectAllParents ( )

◆ selectionAborted()

bool PeerSelector::selectionAborted ( )
true (after destroying "this") if the peer initiator is gone
false (without side effects) otherwise

Definition at line 401 of file peer_select.cc.

References debugs, and interestedInitiator().

Referenced by handlePingTimeout(), noteIp(), noteIps(), noteLookup(), resolveSelected(), and selectMore().

◆ selectMore()

◆ selectPinned()

◆ selectSomeDirect()

void PeerSelector::selectSomeDirect ( )

◆ selectSomeNeighbor()

void PeerSelector::selectSomeNeighbor ( )

◆ selectSomeNeighborReplies()

◆ selectSomeParent()

◆ startPingWaiting()

void PeerSelector::startPingWaiting ( )

◆ toCbdata()

virtual void * CbdataParent::toCbdata ( )
pure virtualinherited

◆ url()

const SBuf PeerSelector::url ( ) const

◆ wantsMoreDestinations()

bool PeerSelector::wantsMoreDestinations ( ) const
whether the initiator may use more destinations

Definition at line 1162 of file peer_select.cc.

References Config, and SquidConfig::forward_max_tries.

Referenced by noteIp(), noteLookup(), and resolveSelected().

Member Data Documentation

◆ acl_checklist

ACLChecklist* PeerSelector::acl_checklist

◆ al

AccessLogEntry::Pointer PeerSelector::al

Definition at line 98 of file PeerSelectState.h.

Referenced by noteIps(), peerAllowedToUse(), and selectMore().

◆ always_direct

Acl::Answer PeerSelector::always_direct

Definition at line 136 of file PeerSelectState.h.

Referenced by checkAlwaysDirectDone(), handlePath(), resolveSelected(), and selectMore().

◆ CheckAlwaysDirectDone

void PeerSelector::CheckAlwaysDirectDone

Definition at line 132 of file PeerSelectState.h.

Referenced by selectMore().

◆ CheckNeverDirectDone

void PeerSelector::CheckNeverDirectDone

Definition at line 133 of file PeerSelectState.h.

Referenced by selectMore().

◆ closest_parent_miss

Ip::Address PeerSelector::closest_parent_miss

◆ direct

◆ entry

◆ first_parent_miss

Ip::Address PeerSelector::first_parent_miss

◆ foundPaths

size_t PeerSelector::foundPaths = 0

Definition at line 139 of file PeerSelectState.h.

Referenced by handlePath(), and resolveSelected().

◆ HandlePingReply

void PeerSelector::HandlePingReply

Definition at line 131 of file PeerSelectState.h.

Referenced by selectSomeNeighbor().

◆ hit

CachePeer* PeerSelector::hit

Definition at line 159 of file PeerSelectState.h.

Referenced by handleHtcpReply(), handleIcpReply(), and selectSomeNeighborReplies().

◆ hit_type

peer_t PeerSelector::hit_type

Definition at line 160 of file PeerSelectState.h.

Referenced by handleHtcpReply(), handleIcpReply(), and selectSomeNeighborReplies().

◆ id

const InstanceId<PeerSelector> PeerSelector::id

Definition at line 166 of file PeerSelectState.h.

◆ initiator_

Initiator PeerSelector::initiator_

Definition at line 164 of file PeerSelectState.h.

Referenced by interestedInitiator().

◆ lastError

ErrorState* PeerSelector::lastError

Definition at line 140 of file PeerSelectState.h.

Referenced by ~PeerSelector(), noteIps(), and resolveSelected().

◆ never_direct

Acl::Answer PeerSelector::never_direct

Definition at line 137 of file PeerSelectState.h.

Referenced by checkNeverDirectDone(), handlePath(), resolveSelected(), and selectMore().

◆ peerCountMcastPeerXXX

void* PeerSelector::peerCountMcastPeerXXX = nullptr

Definition at line 101 of file PeerSelectState.h.

Referenced by peerCountMcastPeersAbort().

◆ ping

◆ request

◆ servers

FwdServer* PeerSelector::servers

Definition at line 142 of file PeerSelectState.h.

Referenced by ~PeerSelector(), addSelection(), noteIp(), noteIps(), and resolveSelected().

The documentation for this class was generated from the following files:






Web Site Translations