File Reference
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "anyp/PortCfg.h"
#include "base/EnumIterator.h"
#include "CacheDigest.h"
#include "CachePeer.h"
#include "comm/Connection.h"
#include "comm/ConnOpener.h"
#include "event.h"
#include "FwdState.h"
#include "globals.h"
#include "htcp.h"
#include "HttpRequest.h"
#include "icmp/net_db.h"
#include "ICP.h"
#include "int.h"
#include "ip/Address.h"
#include "ip/tools.h"
#include "ipcache.h"
#include "MemObject.h"
#include "mgr/Registration.h"
#include "multicast.h"
#include "neighbors.h"
#include "NeighborTypeDomainList.h"
#include "pconn.h"
#include "PeerDigest.h"
#include "PeerPoolMgr.h"
#include "PeerSelectState.h"
#include "RequestFlags.h"
#include "SquidConfig.h"
#include "SquidMath.h"
#include "SquidTime.h"
#include "stat.h"
#include "Store.h"
#include "store_key_md5.h"
#include "tools.h"
#include "URL.h"
Include dependency graph for

Go to the source code of this file.


#define MCAST_COUNT_RATE   900


bool peerAllowedToUse (const CachePeer *, HttpRequest *)
static int peerWouldBePinged (const CachePeer *, HttpRequest *)
static void neighborRemove (CachePeer *)
static void neighborAlive (CachePeer *, const MemObject *, const icp_common_t *)
static void neighborAliveHtcp (CachePeer *, const MemObject *, const HtcpReplyData *)
static void neighborCountIgnored (CachePeer *)
static void peerRefreshDNS (void *)
static void peerProbeConnect (CachePeer *, const bool reprobeIfBusy=false)
static void peerCountMcastPeersDone (void *data)
static void peerCountMcastPeersStart (void *data)
static void peerCountMcastPeersSchedule (CachePeer *p, time_t when)
static void neighborIgnoreNonPeer (const Ip::Address &, icp_opcode)
static void dump_peers (StoreEntry *sentry, CachePeer *peers)
const char * neighborTypeStr (const CachePeer *p)
CachePeerwhichPeer (const Ip::Address &from)
peer_t neighborType (const CachePeer *p, const URL &url)
bool peerCanOpenMore (const CachePeer *p)
 Whether we can open new connections to the peer (e.g., despite max-conn) More...
bool peerHasConnAvailable (const CachePeer *p)
 Whether the peer has idle or standby connections that can be used now. More...
void peerConnClosed (CachePeer *p)
 Notifies peer of an associated connection closure. More...
int peerHTTPOkay (const CachePeer *p, HttpRequest *request)
int neighborsCount (HttpRequest *request)
CachePeergetFirstUpParent (HttpRequest *request)
CachePeergetRoundRobinParent (HttpRequest *request)
CachePeergetWeightedRoundRobinParent (HttpRequest *request)
static void peerClearRRLoop (void *data)
void peerClearRRStart (void)
void peerClearRR ()
void peerAlive (CachePeer *p)
CachePeergetDefaultParent (HttpRequest *request)
CachePeergetNextPeer (CachePeer *p)
CachePeergetFirstPeer (void)
static void neighborsRegisterWithCacheManager ()
void neighbors_init (void)
int neighborsUdpPing (HttpRequest *request, StoreEntry *entry, IRCB *callback, void *callback_data, int *exprep, int *timeout)
lookup_t peerDigestLookup (CachePeer *p, HttpRequest *request)
CachePeerneighborsDigestSelect (HttpRequest *request)
void peerNoteDigestLookup (HttpRequest *request, CachePeer *p, lookup_t lookup)
static void neighborUpdateRtt (CachePeer *p, MemObject *mem)
static int ignoreMulticastReply (CachePeer *p, MemObject *mem)
void neighborsUdpAck (const cache_key *key, icp_common_t *header, const Ip::Address &from)
CachePeerpeerFindByName (const char *name)
CachePeerpeerFindByNameAndPort (const char *name, unsigned short port)
int neighborUp (const CachePeer *p)
void peerNoteDigestGone (CachePeer *p)
time_t peerConnectTimeout (const CachePeer *peer)
time_t positiveTimeout (const time_t timeout)
static void peerDNSConfigure (const ipcache_addrs *ia, const Dns::LookupDetails &, void *data)
static void peerConnectFailedSilent (CachePeer *p)
void peerConnectFailed (CachePeer *p)
void peerConnectSucceded (CachePeer *p)
static bool peerProbeIsBusy (const CachePeer *p)
 whether new TCP probes are currently banned More...
static void peerProbeConnectDone (const Comm::ConnectionPointer &conn, Comm::Flag status, int, void *data)
static void peerCountHandleIcpReply (CachePeer *p, peer_t, AnyP::ProtocolType proto, void *, void *data)
static void neighborDumpPeers (StoreEntry *sentry)
static void neighborDumpNonPeers (StoreEntry *sentry)
void dump_peer_options (StoreEntry *sentry, CachePeer *p)
void neighborsHtcpReply (const cache_key *key, HtcpReplyData *htcp, const Ip::Address &from)
void neighborsHtcpClear (StoreEntry *e, const char *uri, HttpRequest *req, const HttpRequestMethod &method, htcp_clr_reason reason)


static IPH peerDNSConfigure
static CNCB peerProbeConnectDone
static IRCB peerCountHandleIcpReply
static OBJH neighborDumpPeers
static OBJH neighborDumpNonPeers
static unsigned short echo_port
static int NLateReplies = 0
static CachePeerfirst_ping = NULL
static CachePeernon_peers = NULL

Macro Definition Documentation

#define MCAST_COUNT_RATE   900

Definition at line 50 of file

Referenced by peerCountMcastPeersStart().

Function Documentation

CachePeer* getFirstPeer ( void  )

Definition at line 484 of file

References Config, and SquidConfig::peers.

Referenced by statPeerSelect().

CachePeer* getNextPeer ( CachePeer p)

Definition at line 478 of file

References CachePeer::next.

Referenced by statPeerSelect().

static int ignoreMulticastReply ( CachePeer p,
MemObject mem 
static void neighborAlive ( CachePeer p,
const MemObject ,
const icp_common_t header 
static void neighborAliveHtcp ( CachePeer p,
const MemObject ,
const HtcpReplyData htcp 
static void neighborCountIgnored ( CachePeer p)

Definition at line 904 of file

References CachePeer::ignored_replies, NLateReplies, NULL, and CachePeer::stats.

Referenced by neighborsHtcpReply(), and neighborsUdpAck().

static void neighborDumpNonPeers ( StoreEntry sentry)

Definition at line 1468 of file

References dump_peers().

static void neighborDumpPeers ( StoreEntry sentry)

Definition at line 1462 of file

References Config, dump_peers(), and SquidConfig::peers.

static void neighborRemove ( CachePeer target)

Definition at line 490 of file

References Config, CachePeer::next, SquidConfig::npeers, NULL, p, and SquidConfig::peers.

Referenced by neighbors_init(), and neighborsUdpAck().

int neighborsCount ( HttpRequest request)

Definition at line 263 of file

References Config, debugs, CachePeer::next, NULL, p, SquidConfig::peers, and peerWouldBePinged().

Referenced by peerSelectIcpPing().

static void neighborsRegisterWithCacheManager ( )
int neighborsUdpPing ( HttpRequest request,
StoreEntry entry,
IRCB callback,
void *  callback_data,
int exprep,
int timeout 
const char* neighborTypeStr ( const CachePeer p)
bool peerCanOpenMore ( const CachePeer p)
void peerClearRR ( void  )

Called whenever the round-robin counters need to be reset to a sane state. So far those times are:

  • On startup and reconfigure - to set the counters to sane initial settings.
  • When a CachePeer has revived from dead, to prevent the revived CachePeer being flooded with requests which it has 'missed' during the down period.

Definition at line 427 of file

References Config, CachePeer::next, NULL, p, SquidConfig::peers, and CachePeer::rr_count.

Referenced by peerAlive(), and peerClearRRLoop().

static void peerClearRRLoop ( void *  data)

This gets called every 5 minutes to clear the round-robin counter. The exact timing is an arbitrary default, set on estimate timing of a large number of requests in a high-performance environment during the period. The larger the number of requests between cycled resets the more balanced the operations.

Make the reset timing a selectable parameter in squid.conf

Definition at line 398 of file

References eventAdd(), and peerClearRR().

Referenced by peerClearRRStart().

void peerClearRRStart ( void  )

This gets called on startup and restart to kick off the CachePeer round-robin maintenance event. It ensures that no matter how many times its called no more than one event is scheduled.

Definition at line 410 of file

References NULL, and peerClearRRLoop().

Referenced by parse_peer().

time_t peerConnectTimeout ( const CachePeer peer)
static void peerCountMcastPeersSchedule ( CachePeer p,
time_t  when 
CachePeer* peerFindByName ( const char *  name)
CachePeer* peerFindByNameAndPort ( const char *  name,
unsigned short  port 
bool peerHasConnAvailable ( const CachePeer p)

Definition at line 222 of file

References PconnPool::count(), debugs, CachePeer::pool, and CachePeer::standby.

Referenced by peerHTTPOkay().

void peerNoteDigestGone ( CachePeer p)

Definition at line 1155 of file

References cbdataReferenceDone, and CachePeer::digest.

Referenced by peerDigestDestroy().

void peerNoteDigestLookup ( HttpRequest request,
CachePeer p,
lookup_t  lookup 
static void peerProbeConnectDone ( const Comm::ConnectionPointer conn,
Comm::Flag  status,
int  ,
void *  data 
static bool peerProbeIsBusy ( const CachePeer p)
static void peerRefreshDNS ( void *  data)
time_t positiveTimeout ( const time_t  timeout)
max(1, timeout)

Definition at line 1171 of file

References max().

Referenced by FwdState::connectDone(), and PeerPoolMgr::handleOpenedConnection().

Variable Documentation

unsigned short echo_port

Definition at line 74 of file

Referenced by neighbors_init(), and neighborsUdpPing().

CachePeer* first_ping = NULL

Definition at line 77 of file

OBJH neighborDumpNonPeers

Definition at line 71 of file

Referenced by neighborsRegisterWithCacheManager().

OBJH neighborDumpPeers

Definition at line 70 of file

Referenced by neighborsRegisterWithCacheManager().

int NLateReplies = 0

Definition at line 76 of file

Referenced by neighborCountIgnored().

CachePeer* non_peers = NULL

Definition at line 914 of file

Referenced by neighborIgnoreNonPeer().

IRCB peerCountHandleIcpReply

Definition at line 67 of file

Referenced by peerCountMcastPeersStart().

IPH peerDNSConfigure

Definition at line 61 of file

Referenced by peerConnectSucceded(), and peerRefreshDNS().

CNCB peerProbeConnectDone

Definition at line 63 of file

Referenced by peerProbeConnect().






Web Site Translations