peer_select.cc
Go to the documentation of this file.
81 PeerSelectionDumper(const PeerSelector * const aSelector, const CachePeer * const aPeer, const hier_code aCode):
154 eventAdd("PeerSelectorPingMonitor::NoteWaitOver", &PeerSelectorPingMonitor::NoteWaitOver, this, interval, 0, false);
335PeerSelectionInitiator::startSelectingDestinations(HttpRequest *request, const AccessLogEntry::Pointer &ale, StoreEntry *entry)
358 debugs(44, DBG_IMPORTANT, "WARNING: never_direct resulted in " << answer << ". Username ACLs are not reliable here.");
386 debugs(44, DBG_IMPORTANT, "WARNING: always_direct resulted in " << answer << ". Username ACLs are not reliable here.");
466 // Bug 3605: clear any extra listed FwdServer destinations, when the options exceeds max_foward_tries.
468 // TODO: use a std::list so we can get the size and abort adding whenever the selection loops reach Config.forward_max_tries
623 ACLFilledChecklist *ch = new ACLFilledChecklist(Config.accessList.AlwaysDirect, request, nullptr);
632 ACLFilledChecklist *ch = new ACLFilledChecklist(Config.accessList.NeverDirect, request, nullptr);
1069PeerSelector::HandlePingReply(CachePeer * p, peer_t type, AnyP::ProtocolType proto, void *pingdata, void *data)
1072 static_cast<PeerSelector*>(data)->handleIcpReply(p, type, static_cast<icp_common_t*>(pingdata));
1077 static_cast<PeerSelector*>(data)->handleHtcpReply(p, type, static_cast<HtcpReplyData*>(pingdata));
static CodeContext::Pointer & Instance()
guarantees the forever existence of the pointer, starting from the first use
Definition: CodeContext.cc:26
void CallBack(const CodeContext::Pointer &callbackContext, Fun &&callback)
Definition: CodeContext.h:116
void getOutgoingAddress(HttpRequest *request, const Comm::ConnectionPointer &conn)
Definition: FwdState.cc:1476
WaitingPeerSelectors::iterator WaitingPeerSelectorPosition
Definition: PingData.h:22
std::multimap< timeval, PeerSelector *, std::less< timeval >, PoolingAllocator< WaitingPeerSelector > > WaitingPeerSelectors
waiting PeerSelector objects, ordered by their absolute deadlines
Definition: PingData.h:21
virtual void syncAle(HttpRequest *adaptedRequest, const char *logUri) const =0
assigns uninitialized adapted_request and url ALE components
void nonBlockingCheck(ACLCB *callback, void *callback_data)
Definition: Checklist.cc:237
Definition: FilledChecklist.h:32
AccessLogEntry::Pointer al
info for the future access.log, and external ACL
Definition: FilledChecklist.h:101
Definition: Acl.h:128
Definition: CachePeer.h:31
struct CachePeer::@28 options
struct ConnStateData::@37 pinning
Definition: ipcache.h:51
Definition: errorpage.h:89
Definition: peer_select.cc:51
struct timeval peer_select_start
Definition: HierarchyLogEntry.h:65
Definition: htcp.h:22
struct HtcpReplyData::cto_t cto
Definition: HttpRequest.h:49
void recordLookup(const Dns::LookupDetails &detail)
Definition: HttpRequest.cc:580
CbcPointer< ConnStateData > clientConnectionManager
Definition: HttpRequest.h:232
const SBuf & effectiveRequestUri() const
RFC 7230 section 5.5 - Effective Request URI.
Definition: HttpRequest.cc:744
Definition: Address.h:41
a helper class to report a selected destination (for debugging)
Definition: peer_select.cc:79
PeerSelectionDumper(const PeerSelector *const aSelector, const CachePeer *const aPeer, const hier_code aCode)
Definition: peer_select.cc:81
Interface for those who need a list of peers to forward a request to.
Definition: PeerSelectState.h:33
bool subscribed
whether noteDestination() and noteDestinationsEnd() calls are allowed
Definition: PeerSelectState.h:46
void startSelectingDestinations(HttpRequest *request, const AccessLogEntry::Pointer &ale, StoreEntry *entry)
Definition: peer_select.cc:335
Definition: peer_select.cc:109
void monitor(PeerSelector *)
registers the given selector to be notified about the IPC ping timeout
Definition: peer_select.cc:192
static void NoteWaitOver(void *monitor)
PeerSelectorPingMonitor::noteWaitOver() wrapper.
Definition: peer_select.cc:142
void startWaiting()
schedules a single event to represent all waiting selectors
Definition: peer_select.cc:150
void forget(PeerSelector *)
removes a PeerSelector from the waiting list
Definition: peer_select.cc:208
void noteWaitOver()
calls back all ready PeerSelectors and continues to wait for others
Definition: peer_select.cc:168
Definition: PeerSelectState.h:60
void selectAllParents()
Adds alive parents. Used as a last resort for never_direct.
Definition: peer_select.cc:867
PeerSelectionInitiator * interestedInitiator()
Definition: peer_select.cc:1143
Initiator initiator_
recipient of the destinations we select; use interestedInitiator() to access
Definition: PeerSelectState.h:164
static void HandlePingTimeout(PeerSelector *)
called when the given selector should stop expecting ICP ping responses
Definition: peer_select.cc:916
void noteIps(const Dns::CachedIps *ips, const Dns::LookupDetails &details) override
Definition: peer_select.cc:542
void selectMore()
a single selection loop iteration: attempts to add more destinations
Definition: peer_select.cc:611
void startPingWaiting()
switches into the PING_WAITING state (and associated timeout monitoring)
Definition: peer_select.cc:263
void handleIcpParentMiss(CachePeer *, icp_common_t *)
Definition: peer_select.cc:928
void cancelPingTimeoutMonitoring()
terminates ICP ping timeout monitoring
Definition: peer_select.cc:272
void handlePath(const Comm::ConnectionPointer &path, FwdServer &fs)
processes a newly discovered/finalized path
Definition: peer_select.cc:1168
bool wantsMoreDestinations() const
Definition: peer_select.cc:1162
void checkNeverDirectDone(const Acl::Answer answer)
Definition: peer_select.cc:343
void checkAlwaysDirectDone(const Acl::Answer answer)
Definition: peer_select.cc:371
void handleHtcpReply(CachePeer *, const peer_t, HtcpReplyData *)
Definition: peer_select.cc:1004
void handleIcpReply(CachePeer *, const peer_t, icp_common_t *header)
Definition: peer_select.cc:971
static ACLCB CheckNeverDirectDone
Definition: PeerSelectState.h:133
void addSelection(CachePeer *, const hier_code)
Definition: peer_select.cc:1086
static ACLCB CheckAlwaysDirectDone
Definition: PeerSelectState.h:132
void noteLookup(const Dns::LookupDetails &details) override
Definition: peer_select.cc:502
void selectSomeDirect()
Adds a "direct" entry if the request can be forwarded to the origin server.
Definition: peer_select.cc:820
void noteIp(const Ip::Address &ip) override
Called when/if nbgethostbyname() discovers a new good IP address.
Definition: peer_select.cc:516
void resolveSelected()
A single DNS resolution loop iteration: Converts selected FwdServer to IPs.
Definition: peer_select.cc:413
void selectPinned()
Selects a pinned connection if it exists, is valid, and is allowed.
Definition: peer_select.cc:707
void selectSomeNeighborReplies()
Selects a neighbor (parent or sibling) based on ICP/HTCP replies.
Definition: peer_select.cc:789
void handleHtcpParentMiss(CachePeer *, HtcpReplyData *)
Definition: peer_select.cc:1026
struct SquidConfig::@107 accessList
struct SquidConfig::@106 onoff
Definition: Store.h:42
Definition: ICP.h:35
WaitingPeerSelectorPosition monitorRegistration
maintained by PeerSelectorPingMonitor
Definition: PingData.h:49
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:107
int neighbors_do_private_keys
const char * hier_code_str[]
const char * icp_opcode_str[]
void nbgethostbyname(const char *name, const CbcPointer< IpReceiver > &receiver)
initiate an (often) asynchronous DNS lookup; the receiver gets the results
Definition: ipcache.cc:615
void peerNoteDigestLookup(HttpRequest *request, CachePeer *p, lookup_t lookup)
Definition: neighbors.cc:813
peer_t neighborType(const CachePeer *p, const AnyP::Uri &url)
Definition: neighbors.cc:114
int neighborsUdpPing(HttpRequest *request, StoreEntry *entry, IRCB *callback, PeerSelector *ps, int *exprep, int *timeout)
Definition: neighbors.cc:550
CachePeer * neighborsDigestSelect(PeerSelector *ps)
Definition: neighbors.cc:751
lookup_t peerDigestLookup(CachePeer *p, PeerSelector *ps)
Definition: neighbors.cc:705
CachePeer * getWeightedRoundRobinParent(PeerSelector *ps)
Definition: neighbors.cc:355
void netdbUpdatePeer(const AnyP::Uri &url, CachePeer *e, int irtt, int ihops)
Definition: net_db.cc:1002
InstanceIdDefinitions(PeerSelector, "PeerSelector")
static int peerSelectIcpPing(PeerSelector *ps, int direct, StoreEntry *entry)
Definition: peer_select.cc:278
static struct @82 PeerStats
bool peerAllowedToUse(const CachePeer *, PeerSelector *)
Definition: neighbors.cc:137
static void peerSelect(PeerSelectionInitiator *initiator, HttpRequest *request, AccessLogEntry::Pointer const &al, StoreEntry *entry)
Definition: peer_select.cc:304
static std::ostream & operator<<(std::ostream &os, const PeerSelectionDumper &fsd)
prints PeerSelectionDumper (for debugging)
Definition: peer_select.cc:93
static PeerSelectorPingMonitor & PingMonitor()
monitors all PeerSelector ICP ping timeouts
Definition: peer_select.cc:132
CachePeer * peerSourceHashSelectParent(PeerSelector *ps)
Definition: peer_sourcehash.cc:138
CachePeer * peerUserHashSelectParent(PeerSelector *ps)
Definition: peer_userhash.cc:143
time_t struct timeval struct timeval struct timeval struct timeval const struct timeval const &STUB void tvAdd(struct timeval &, struct timeval const &, struct timeval const &) STUB void tvAssignAdd(struct timeval &
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:17