#include "squid.h"
#include "base/IoManip.h"
#include "CacheDigest.h"
#include "CachePeer.h"
#include "event.h"
#include "FwdState.h"
#include "globals.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "internal.h"
#include "MemObject.h"
#include "mime_header.h"
#include "neighbors.h"
#include "PeerDigest.h"
#include "Store.h"
#include "store_key_md5.h"
#include "StoreClient.h"
#include "tools.h"
#include "util.h"
Go to the source code of this file.
Macros | |
#define | StoreDigestCBlockSize sizeof(StoreDigestCBlock) |
#define | f2s(flag) (pd->flags.flag ? "yes" : "no") |
#define | appendTime(tm) |
Functions | |
static time_t | peerDigestIncDelay (const PeerDigest *pd) |
static time_t | peerDigestNewDelay (const StoreEntry *e) |
static void | peerDigestSetCheck (PeerDigest *pd, time_t delay) |
static void | peerDigestRequest (PeerDigest *pd) |
static int | peerDigestFetchReply (void *data, char *buf, ssize_t size) |
handle HTTP response headers in the initial storeClientCopy() response More... | |
int | peerDigestSwapInCBlock (void *, char *, ssize_t) |
int | peerDigestSwapInMask (void *, char *, ssize_t) |
static int | peerDigestFetchedEnough (DigestFetchState *fetch, char *buf, ssize_t size, const char *step_name) |
static void | peerDigestFetchStop (DigestFetchState *fetch, char *buf, const char *reason) |
static void | peerDigestFetchAbort (DigestFetchState *fetch, char *buf, const char *reason) |
static void | peerDigestReqFinish (DigestFetchState *fetch, char *buf, int, int, int, const char *reason, int err) |
static void | peerDigestPDFinish (DigestFetchState *fetch, int pcb_valid, int err) |
static void | peerDigestFetchFinish (DigestFetchState *fetch, int err) |
static void | peerDigestFetchSetStats (DigestFetchState *fetch) |
static int | peerDigestSetCBlock (PeerDigest *pd, const char *buf) |
static int | peerDigestUseful (const PeerDigest *pd) |
void | peerDigestNeeded (PeerDigest *pd) |
void | peerDigestNotePeerGone (PeerDigest *pd) |
static void | peerDigestCheck (void *data) |
static void | peerDigestHandleReply (void *data, StoreIOBuffer receivedData) |
static int | saneDiff (time_t diff) |
void | peerDigestStatsReport (const PeerDigest *pd, StoreEntry *e) |
Variables | |
static EVH | peerDigestCheck |
static STCB | peerDigestHandleReply |
Version const | CacheDigestVer = { 5, 3 } |
static const time_t | PeerDigestReqMinGap = 5 * 60 |
static const time_t | GlobDigestReqMinGap = 1 * 60 |
static time_t | pd_last_req_time = 0 |
Macro Definition Documentation
◆ appendTime
#define appendTime | ( | tm | ) |
◆ f2s
#define f2s | ( | flag | ) | (pd->flags.flag ? "yes" : "no") |
◆ StoreDigestCBlockSize
#define StoreDigestCBlockSize sizeof(StoreDigestCBlock) |
Definition at line 57 of file peer_digest.cc.
Function Documentation
◆ peerDigestCheck()
|
static |
Definition at line 190 of file peer_digest.cc.
References assert, debugs, PeerDigest::flags, GlobDigestReqMinGap, PeerDigest::host, PeerDigest::next_check, pd_last_req_time, PeerDigest::peer, peerDigestNotePeerGone(), PeerDigestReqMinGap, peerDigestRequest(), peerDigestSetCheck(), RawPointer(), PeerDigest::received, PeerDigest::requested, CbcPointer< Cbc >::set(), squid_curtime, PeerDigest::times, and CbcPointer< Cbc >::valid().
◆ peerDigestFetchAbort()
|
static |
Definition at line 675 of file peer_digest.cc.
References assert, debugs, PeerDigest::host, DigestFetchState::pd, and peerDigestReqFinish().
Referenced by peerDigestFetchReply(), peerDigestHandleReply(), and peerDigestSwapInCBlock().
◆ peerDigestFetchedEnough()
|
static |
Definition at line 600 of file peer_digest.cc.
References assert, cbdataReferenceValid(), PeerDigest::cd, debugs, EBIT_TEST, DigestFetchState::entry, ENTRY_ABORTED, StoreEntry::flags, PeerDigest::host, DigestFetchState::mask_offset, CacheDigest::mask_size, DigestFetchState::offset, DigestFetchState::pd, PeerDigest::peer, peerDigestReqFinish(), peerDigestUseful(), size, and CbcPointer< Cbc >::valid().
Referenced by peerDigestFetchReply(), peerDigestHandleReply(), peerDigestSwapInCBlock(), and peerDigestSwapInMask().
◆ peerDigestFetchFinish()
|
static |
Definition at line 764 of file peer_digest.cc.
References assert, DigestFetchState::bytes, StatCounters::cd, debugs, DigestFetchState::entry, StatCounters::kbytes_recv, StatCounters::kbytes_sent, DigestFetchState::msg, StatCounters::msgs_recv, StatCounters::msgs_sent, DigestFetchState::old_entry, DigestFetchState::old_sc, DigestFetchState::recv, StoreEntry::releaseRequest(), DigestFetchState::request, DigestFetchState::sent, statCounter, storeUnregister(), and StoreEntry::unlock().
Referenced by peerDigestReqFinish().
◆ peerDigestFetchReply()
|
static |
Definition at line 448 of file peer_digest.cc.
References assert, PeerDigest::cd, debugs, DIGEST_READ_CBLOCK, DIGEST_READ_DONE, DIGEST_READ_REPLY, DigestFetchState::entry, MemObject::freshestReply(), PeerDigest::host, StoreEntry::mem(), StoreEntry::mem_obj, DigestFetchState::offset, DigestFetchState::old_entry, DigestFetchState::old_sc, DigestFetchState::pd, peerDigestFetchAbort(), peerDigestFetchedEnough(), peerDigestFetchStop(), StoreEntry::releaseRequest(), MemObject::request, Store::Root(), DigestFetchState::sc, Http::scNone, Http::scNotModified, Http::scOkay, size, HttpReply::sline, squid_curtime, DigestFetchState::state, Http::StatusLine::status(), storeUnregister(), and StoreEntry::unlock().
Referenced by peerDigestHandleReply().
◆ peerDigestFetchSetStats()
|
static |
Definition at line 787 of file peer_digest.cc.
References assert, DigestFetchState::bytes, debugs, DigestFetchState::entry, DigestFetchState::expires, StoreEntry::expires, StoreEntry::lastModified(), StoreEntry::mem_obj, DigestFetchState::msg, HttpRequest::prefixLen(), DigestFetchState::recv, DigestFetchState::request, DigestFetchState::resp_time, DigestFetchState::sent, MemObject::size(), squid_curtime, and DigestFetchState::start_time.
Referenced by peerDigestReqFinish().
◆ peerDigestFetchStop()
|
static |
Definition at line 666 of file peer_digest.cc.
References assert, debugs, PeerDigest::host, DigestFetchState::pd, and peerDigestReqFinish().
Referenced by peerDigestFetchReply().
◆ peerDigestHandleReply()
|
static |
Definition at line 340 of file peer_digest.cc.
References assert, store_client::atEof(), DigestFetchState::buf, DigestFetchState::bufofs, cbdataReferenceValid(), StoreIOBuffer::data, DIGEST_READ_CBLOCK, DIGEST_READ_DONE, DIGEST_READ_MASK, DIGEST_READ_NONE, DIGEST_READ_REPLY, DigestFetchState::entry, StoreIOBuffer::error, fatal(), StoreIOBuffer::flags, StoreIOBuffer::length, DigestFetchState::offset, StoreIOBuffer::offset, DigestFetchState::pd, peerDigestFetchAbort(), peerDigestFetchedEnough(), peerDigestFetchReply(), peerDigestHandleReply, peerDigestSwapInCBlock(), peerDigestSwapInMask(), DigestFetchState::sc, SM_PAGE_SIZE, DigestFetchState::state, and storeClientCopy().
◆ peerDigestIncDelay()
|
static |
Definition at line 141 of file peer_digest.cc.
References assert, PeerDigestReqMinGap, PeerDigest::retry_delay, and PeerDigest::times.
Referenced by peerDigestReqFinish().
◆ peerDigestNeeded()
void peerDigestNeeded | ( | PeerDigest * | pd | ) |
Definition at line 128 of file peer_digest.cc.
References assert, PeerDigest::cd, PeerDigest::flags, PeerDigest::needed, peerDigestSetCheck(), squid_curtime, and PeerDigest::times.
Referenced by peerDigestLookup().
◆ peerDigestNewDelay()
|
static |
Definition at line 152 of file peer_digest.cc.
References assert, StoreEntry::expires, PeerDigestReqMinGap, and squid_curtime.
Referenced by peerDigestReqFinish().
◆ peerDigestNotePeerGone()
void peerDigestNotePeerGone | ( | PeerDigest * | pd | ) |
Definition at line 175 of file peer_digest.cc.
References debugs, PeerDigest::flags, PeerDigest::host, and PeerDigest::requested.
Referenced by CachePeer::~CachePeer(), peerDigestCheck(), and peerDigestPDFinish().
◆ peerDigestPDFinish()
|
static |
Definition at line 724 of file peer_digest.cc.
References assert, DigestFetchState::bytes, cbdataReferenceDone, PeerDigest::cd, DBG_IMPORTANT, debugs, DigestFetchState::entry, PeerDigest::flags, PeerDigest::host, PeerDigest::kbytes, DigestFetchState::msg, PeerDigest::msgs, DigestFetchState::pd, peerDigestNotePeerGone(), PeerDigest::received, DigestFetchState::recv, PeerDigest::recv, PeerDigest::req_delay, PeerDigest::req_result, DigestFetchState::resp_time, DigestFetchState::sent, PeerDigest::sent, squid_curtime, PeerDigest::stats, STORE_OK, StoreEntry::store_status, PeerDigest::times, and PeerDigest::usable.
Referenced by peerDigestReqFinish().
◆ peerDigestReqFinish()
|
static |
Definition at line 684 of file peer_digest.cc.
References assert, DigestFetchState::entry, PeerDigest::flags, DigestFetchState::pd, peerDigestFetchFinish(), peerDigestFetchSetStats(), peerDigestIncDelay(), peerDigestNewDelay(), peerDigestPDFinish(), peerDigestSetCheck(), PeerDigest::req_result, PeerDigest::requested, PeerDigest::retry_delay, and PeerDigest::times.
Referenced by peerDigestFetchAbort(), peerDigestFetchedEnough(), and peerDigestFetchStop().
◆ peerDigestRequest()
|
static |
Definition at line 242 of file peer_digest.cc.
References Http::ACCEPT, assert, DigestFetchState::buf, RequestFlags::cachable, StoreIOBuffer::data, debugs, EBIT_TEST, StoreEntry::ensureMemObject(), DigestFetchState::entry, HttpRequest::flags, PeerDigest::flags, StoreEntry::flags, HttpRequest::FromUrlXXX(), FwdState::fwdStart(), CbcPointer< Cbc >::get(), Http::Message::header, internalRemoteUri(), KEY_PRIVATE, StoreEntry::lastModified(), HttpHeader::len, StoreIOBuffer::length, StoreEntry::lock(), HttpRequest::method, StoreIOBuffer::offset, DigestFetchState::old_entry, DigestFetchState::old_sc, pd_last_req_time, PeerDigest::peer, peerDigestHandleReply, HttpHeader::putStr(), RequestFlags::refresh, PeerDigest::req_result, PeerDigest::requested, safe_free, DigestFetchState::sc, SM_PAGE_SIZE, squid_curtime, storeClientCopy(), storeClientListAdd(), storeCreateEntry(), StoreDigestFileName, StoreDigestMimeStr, storeGetPublicByRequest(), SupportOrVeto::support(), PeerDigest::times, HttpRequest::url, AnyP::Uri::userInfo(), and xstrdup.
Referenced by peerDigestCheck().
◆ peerDigestSetCBlock()
|
static |
Definition at line 819 of file peer_digest.cc.
References assert, StoreDigestCBlock::bits_per_entry, CacheDigestHashFuncCount, CacheDigestVer, CacheDigest::CalcMaskSize(), StoreDigestCBlock::capacity, PeerDigest::cd, StatCounters::cd, CacheDigest::count, StoreDigestCBlock::count, Version::current, DBG_CRITICAL, DBG_IMPORTANT, debugs, CacheDigest::del_count, StoreDigestCBlock::del_count, StoreDigestCBlock::hash_func_count, PeerDigest::host, CacheDigest::mask_size, StoreDigestCBlock::mask_size, StatCounters::memory, Version::required, statCounter, StoreDigestCBlock::ver, and xpercentInt().
Referenced by peerDigestSwapInCBlock().
◆ peerDigestSetCheck()
|
static |
Definition at line 164 of file peer_digest.cc.
References debugs, eventAdd(), PeerDigest::host, PeerDigest::next_check, peerDigestCheck, squid_curtime, and PeerDigest::times.
Referenced by peerDigestCheck(), peerDigestNeeded(), and peerDigestReqFinish().
◆ peerDigestStatsReport()
void peerDigestStatsReport | ( | const PeerDigest * | pd, |
StoreEntry * | e | ||
) |
Definition at line 932 of file peer_digest.cc.
References appendTime, assert, cacheDigestGuessStatsReport(), cacheDigestReport(), PeerDigest::cd, f2s, PeerDigest::guess, PeerDigest::host, ByteCounter::kb, PeerDigest::kbytes, PeerDigest::msgs, PeerDigest::recv, PeerDigest::req_delay, PeerDigest::req_result, PeerDigest::retry_delay, PeerDigest::sent, SQUIDSBUFPH, SQUIDSBUFPRINT, PeerDigest::stats, storeAppendPrintf(), and PeerDigest::times.
Referenced by statPeerSelect().
◆ peerDigestSwapInCBlock()
int peerDigestSwapInCBlock | ( | void * | data, |
char * | buf, | ||
ssize_t | size | ||
) |
Definition at line 528 of file peer_digest.cc.
References assert, PeerDigest::cd, DIGEST_READ_CBLOCK, DIGEST_READ_MASK, DigestFetchState::entry, CacheDigest::mask, StoreEntry::mem_obj, DigestFetchState::pd, peerDigestFetchAbort(), peerDigestFetchedEnough(), peerDigestSetCBlock(), size, SM_PAGE_SIZE, DigestFetchState::state, and StoreDigestCBlockSize.
Referenced by peerDigestHandleReply().
◆ peerDigestSwapInMask()
int peerDigestSwapInMask | ( | void * | data, |
char * | buf, | ||
ssize_t | size | ||
) |
Definition at line 566 of file peer_digest.cc.
References assert, PeerDigest::cd, debugs, CacheDigest::mask, DigestFetchState::mask_offset, CacheDigest::mask_size, DigestFetchState::pd, peerDigestFetchedEnough(), and size.
Referenced by peerDigestHandleReply().
◆ peerDigestUseful()
|
static |
Definition at line 911 of file peer_digest.cc.
References PeerDigest::cd, DBG_CRITICAL, debugs, PeerDigest::host, and CacheDigest::usedMaskPercent().
Referenced by peerDigestFetchedEnough().
◆ saneDiff()
|
static |
Definition at line 926 of file peer_digest.cc.
References squid_curtime.
Variable Documentation
◆ CacheDigestVer
Version const CacheDigestVer = { 5, 3 } |
Definition at line 55 of file peer_digest.cc.
Referenced by peerDigestSetCBlock(), and storeDigestCBlockSwapOut().
◆ GlobDigestReqMinGap
|
static |
Definition at line 62 of file peer_digest.cc.
Referenced by peerDigestCheck().
◆ pd_last_req_time
|
static |
Definition at line 66 of file peer_digest.cc.
Referenced by peerDigestCheck(), and peerDigestRequest().
◆ peerDigestCheck
|
static |
Definition at line 38 of file peer_digest.cc.
Referenced by PeerDigest::~PeerDigest(), and peerDigestSetCheck().
◆ peerDigestHandleReply
|
static |
Definition at line 40 of file peer_digest.cc.
Referenced by peerDigestHandleReply(), and peerDigestRequest().
◆ PeerDigestReqMinGap
|
static |
Definition at line 60 of file peer_digest.cc.
Referenced by peerDigestCheck(), peerDigestIncDelay(), and peerDigestNewDelay().