#include <ClientInfo.h>
![Inheritance graph](classClientInfo__inherit__graph.png)
![Collaboration graph](classClientInfo__coll__graph.png)
Classes | |
struct | Cutoff |
struct | Protocol |
Public Member Functions | |
ClientInfo (const Ip::Address &) | |
~ClientInfo () override | |
bool | hasQueue () const |
whether any clients are waiting for write quota More... | |
bool | hasQueue (const CommQuotaQueue *) const |
has a given queue More... | |
unsigned int | quotaEnqueue (int fd) |
client starts waiting in queue; create the queue if necessary More... | |
int | quotaPeekFd () const |
returns the next fd reservation More... | |
unsigned int | quotaPeekReserv () const |
returns the next reserv. to pop More... | |
void | quotaDequeue () |
pops queue head from queue More... | |
void | kickQuotaQueue () |
void | writeOrDequeue () |
either selects the head descriptor for writing or calls quotaDequeue() More... | |
int | quota () override |
allocate quota for a just dequeued client More... | |
bool | applyQuota (int &nleft, Comm::IoCallback *state) override |
void | scheduleWrite (Comm::IoCallback *state) override |
Will plan another write call. More... | |
void | onFdClosed () override |
Performs cleanup when the related file descriptor becomes closed. More... | |
void | reduceBucket (int len) override |
Decreases the bucket level. More... | |
void | quotaDumpQueue () |
dumps quota queue for debugging More... | |
void | setWriteLimiter (const int aWriteSpeedLimit, const double anInitialBurst, const double aHighWatermark) |
bool | noLimit () const |
Whether this bucket will not do bandwidth limiting. More... | |
Static Public Member Functions | |
static BandwidthBucket * | SelectBucket (fde *f) |
Public Attributes | |
Ip::Address | addr |
struct ClientInfo::Protocol | Http |
struct ClientInfo::Protocol | Icp |
struct ClientInfo::Cutoff | cutoff |
int | n_established |
time_t | last_seen |
bool | writeLimitingActive |
Is write limiter active. More... | |
bool | firstTimeConnection |
is this first time connection for this client More... | |
CommQuotaQueue * | quotaQueue |
clients waiting for more write quota More... | |
int | rationedQuota |
precomputed quota preserving fairness among clients More... | |
int | rationedCount |
number of clients that will receive rationedQuota More... | |
bool | eventWaiting |
waiting for commHandleWriteHelper event to fire More... | |
void * | key |
hash_link * | next |
double | bucketLevel |
how much can be written now More... | |
bool | selectWaiting |
is between commSetSelect and commHandleWrite More... | |
Protected Member Functions | |
void | refillBucket () |
Increases the bucket level with the writeSpeedLimit speed. More... | |
Protected Attributes | |
double | prevTime |
previous time when we checked More... | |
double | writeSpeedLimit |
Write speed limit in bytes per second. More... | |
double | bucketSizeLimit |
maximum bucket size More... | |
Private Member Functions | |
MEMPROXY_CLASS (ClientInfo) | |
Detailed Description
Definition at line 30 of file ClientInfo.h.
Constructor & Destructor Documentation
◆ ClientInfo()
|
explicit |
Definition at line 54 of file client_db.cc.
References addr, debugs, hash_link::key, MAX_IPSTRLEN, Ip::Address::toStr(), and xmalloc.
◆ ~ClientInfo()
|
override |
Definition at line 335 of file client_db.cc.
References debugs, hash_link::key, quotaQueue, and safe_free.
Member Function Documentation
◆ applyQuota()
|
overridevirtual |
Adjusts nleft to not exceed the current bucket quota value, if needed.
Reimplemented from BandwidthBucket.
Definition at line 1318 of file comm.cc.
References BandwidthBucket::applyQuota(), assert, Comm::IoCallback::conn, Comm::Connection::fd, hasQueue(), kickQuotaQueue(), quotaDequeue(), quotaEnqueue(), quotaPeekFd(), and Comm::IoCallback::quotaQueueReserv.
◆ hasQueue() [1/2]
bool ClientInfo::hasQueue | ( | ) | const |
Definition at line 1228 of file comm.cc.
References assert, CommQuotaQueue::empty(), and quotaQueue.
Referenced by applyQuota(), commHandleWriteHelper(), and kickQuotaQueue().
◆ hasQueue() [2/2]
bool ClientInfo::hasQueue | ( | const CommQuotaQueue * | q | ) | const |
Definition at line 1235 of file comm.cc.
References assert, and quotaQueue.
◆ kickQuotaQueue()
void ClientInfo::kickQuotaQueue | ( | ) |
schedule commHandleWriteHelper call
Definition at line 1274 of file comm.cc.
References BandwidthBucket::bucketLevel, commHandleWriteHelper(), eventAdd(), eventWaiting, hasQueue(), quotaQueue, and BandwidthBucket::selectWaiting.
Referenced by applyQuota(), onFdClosed(), reduceBucket(), and scheduleWrite().
◆ MEMPROXY_CLASS()
|
private |
◆ noLimit()
|
inlineinherited |
Definition at line 41 of file BandwidthBucket.h.
References BandwidthBucket::writeSpeedLimit.
Referenced by MessageBucket::quota(), BandwidthBucket::reduceBucket(), and BandwidthBucket::refillBucket().
◆ onFdClosed()
|
overridevirtual |
Reimplemented from BandwidthBucket.
Definition at line 1341 of file comm.cc.
References kickQuotaQueue(), and BandwidthBucket::onFdClosed().
◆ quota()
|
overridevirtual |
calculates how much to write for a single dequeued client
Implements BandwidthBucket.
Definition at line 1287 of file comm.cc.
References BandwidthBucket::bucketLevel, debugs, last_seen, quotaQueue, rationedCount, rationedQuota, BandwidthBucket::refillBucket(), CommQuotaQueue::size(), and squid_curtime.
◆ quotaDequeue()
void ClientInfo::quotaDequeue | ( | ) |
removes queue head
Definition at line 1267 of file comm.cc.
References assert, CommQuotaQueue::dequeue(), and quotaQueue.
Referenced by applyQuota().
◆ quotaDumpQueue()
void ClientInfo::quotaDumpQueue | ( | ) |
◆ quotaEnqueue()
queues a given fd, creating the queue if necessary; returns reservation ID
Definition at line 1259 of file comm.cc.
References assert, CommQuotaQueue::enqueue(), and quotaQueue.
Referenced by applyQuota(), and scheduleWrite().
◆ quotaPeekFd()
int ClientInfo::quotaPeekFd | ( | ) | const |
returns the first descriptor to be dequeued
Definition at line 1243 of file comm.cc.
References assert, CommQuotaQueue::front(), and quotaQueue.
Referenced by applyQuota(), and writeOrDequeue().
◆ quotaPeekReserv()
unsigned int ClientInfo::quotaPeekReserv | ( | ) | const |
returns the reservation ID of the first descriptor to be dequeued
Definition at line 1251 of file comm.cc.
References assert, CommQuotaQueue::outs, and quotaQueue.
◆ reduceBucket()
|
overridevirtual |
Reimplemented from BandwidthBucket.
Definition at line 1349 of file comm.cc.
References kickQuotaQueue(), and BandwidthBucket::reduceBucket().
◆ refillBucket()
|
protectedinherited |
Definition at line 31 of file BandwidthBucket.cc.
References BandwidthBucket::bucketLevel, BandwidthBucket::bucketSizeLimit, current_dtime, debugs, BandwidthBucket::noLimit(), BandwidthBucket::prevTime, and BandwidthBucket::writeSpeedLimit.
Referenced by MessageBucket::quota(), and quota().
◆ scheduleWrite()
|
overridevirtual |
Implements BandwidthBucket.
Definition at line 1332 of file comm.cc.
References Comm::IoCallback::conn, Comm::Connection::fd, kickQuotaQueue(), quotaEnqueue(), Comm::IoCallback::quotaQueueReserv, and writeLimitingActive.
◆ SelectBucket()
|
staticinherited |
Definition at line 95 of file BandwidthBucket.cc.
References fde::clientInfo, RefCount< C >::getRaw(), writeLimitingActive, and fde::writeQuotaHandler.
Referenced by _comm_close(), and Comm::IoCallback::selectOrQueueWrite().
◆ setWriteLimiter()
void ClientInfo::setWriteLimiter | ( | const int | aWriteSpeedLimit, |
const double | anInitialBurst, | ||
const double | aHighWatermark | ||
) |
Configure client write limiting (note:"client" here means - IP). It is called by httpAccept in client_side.cc, where the initial bucket size (anInitialBurst) computed, using the configured maximum bucket value and configured initial bucket value(50% by default).
- Parameters
-
writeSpeedLimit is speed limit configured in config for this pool initialBurst is initial bucket size to use for this client(i.e. client can burst at first) highWatermark is maximum bucket value
Definition at line 1358 of file comm.cc.
References assert, BandwidthBucket::bucketLevel, BandwidthBucket::bucketSizeLimit, current_dtime, debugs, firstTimeConnection, hash_link::key, BandwidthBucket::prevTime, quotaQueue, BandwidthBucket::selectWaiting, writeLimitingActive, and BandwidthBucket::writeSpeedLimit.
Referenced by ConnStateData::whenClientIpKnown().
◆ writeOrDequeue()
void ClientInfo::writeOrDequeue | ( | ) |
Definition at line 1206 of file comm.cc.
References assert, CallBack(), fd_table, head, quotaPeekFd(), and BandwidthBucket::selectWaiting.
Referenced by commHandleWriteHelper().
Member Data Documentation
◆ addr
Ip::Address ClientInfo::addr |
Definition at line 45 of file ClientInfo.h.
Referenced by client_entry(), clientdbDump(), ClientInfo(), and snmp_meshCtblFn().
◆ bucketLevel
|
inherited |
Definition at line 48 of file BandwidthBucket.h.
Referenced by kickQuotaQueue(), MessageBucket::quota(), quota(), BandwidthBucket::reduceBucket(), BandwidthBucket::refillBucket(), and setWriteLimiter().
◆ bucketSizeLimit
|
protectedinherited |
Definition at line 54 of file BandwidthBucket.h.
Referenced by BandwidthBucket::refillBucket(), and setWriteLimiter().
◆ cutoff
struct ClientInfo::Cutoff ClientInfo::cutoff |
Referenced by clientdbCutoffDenied().
◆ eventWaiting
bool ClientInfo::eventWaiting |
Definition at line 75 of file ClientInfo.h.
Referenced by commHandleWriteHelper(), and kickQuotaQueue().
◆ firstTimeConnection
bool ClientInfo::firstTimeConnection |
Definition at line 70 of file ClientInfo.h.
Referenced by setWriteLimiter().
◆ Http
struct ClientInfo::Protocol ClientInfo::Http |
Referenced by clientdbDump(), clientdbGC(), clientdbUpdate(), and snmp_meshCtblFn().
◆ Icp
struct ClientInfo::Protocol ClientInfo::Icp |
Referenced by clientdbCutoffDenied(), clientdbDump(), clientdbGC(), clientdbUpdate(), and snmp_meshCtblFn().
◆ key
|
inherited |
Definition at line 19 of file hash.h.
Referenced by ACLExternal::aclMatchExternal(), MemStore::anchorToCache(), Rock::SwapDir::anchorToCache(), Store::CheckSwapMetaKey(), StoreEntry::clearPublicKeyScope(), ClientInfo(), Rock::SwapDir::createStoreIO(), CommQuotaQueue::dequeue(), destroyStoreEntry(), CommQuotaQueue::enqueue(), external_acl_cache_add(), StoreEntry::forcePublicKey(), fqdncache_entry::fqdncache_entry(), fqdncacheAddEntry(), fqdncacheParse(), StoreEntry::getMD5Text(), hash_join(), hash_remove_link(), StoreEntry::hashDelete(), StoreEntry::hashInsert(), hashKeyStr(), Rock::SwapDir::hasReadableEntry(), htcpQuery(), IdleConnList::IdleConnList(), idnsStartQuery(), ipcache_entry::ipcache_entry(), ipcacheAddEntry(), ipcacheRelease(), Fs::Ufs::UFSSwapDir::logEntry(), Store::Controller::markedForDeletionAndAbandoned(), my_free(), ipcache_entry::name(), neighborsUdpPing(), net_db_name::net_db_name(), netdbHashInsert(), Ipc::StoreMap::openForUpdating(), Store::PackFields(), peerCountMcastPeersCreateAndSend(), StoreEntry::publicKey(), read_passwd_file(), Ipc::StoreMapAnchor::set(), StoreEntry::setPrivateKey(), StoreEntry::setPublicKey(), setWriteLimiter(), MemStore::startCaching(), storeDigestAdd(), storeDigestDel(), storeKeyHashHash(), storeKeyText(), storeRebuildParseEntry(), Store::UnpackIndexSwapMeta(), WIN32_StoreKey(), wordlistAdd(), UFSCleanLog::write(), ~ClientInfo(), ExternalACLEntry::~ExternalACLEntry(), fqdncache_entry::~fqdncache_entry(), IdleConnList::~IdleConnList(), and net_db_name::~net_db_name().
◆ last_seen
time_t ClientInfo::last_seen |
Definition at line 67 of file ClientInfo.h.
Referenced by clientdbGC(), clientdbUpdate(), and quota().
◆ n_established
int ClientInfo::n_established |
Definition at line 66 of file ClientInfo.h.
Referenced by clientdbDump(), clientdbEstablished(), and clientdbGC().
◆ next
|
inherited |
Definition at line 20 of file hash.h.
Referenced by clientdbGC(), Store::LocalSearch::copyBucket(), StoreEntry::dump(), hash_join(), hash_lookup(), hash_next(), hash_remove_link(), IdleConnList::IdleConnList(), and lru_stats().
◆ prevTime
|
protectedinherited |
Definition at line 52 of file BandwidthBucket.h.
Referenced by BandwidthBucket::BandwidthBucket(), BandwidthBucket::refillBucket(), and setWriteLimiter().
◆ quotaQueue
CommQuotaQueue* ClientInfo::quotaQueue |
Definition at line 72 of file ClientInfo.h.
Referenced by hasQueue(), kickQuotaQueue(), quota(), quotaDequeue(), quotaEnqueue(), quotaPeekFd(), quotaPeekReserv(), setWriteLimiter(), and ~ClientInfo().
◆ rationedCount
int ClientInfo::rationedCount |
Definition at line 74 of file ClientInfo.h.
Referenced by quota().
◆ rationedQuota
int ClientInfo::rationedQuota |
Definition at line 73 of file ClientInfo.h.
Referenced by quota().
◆ selectWaiting
|
inherited |
Definition at line 49 of file BandwidthBucket.h.
Referenced by commHandleWriteHelper(), kickQuotaQueue(), BandwidthBucket::onFdClosed(), setWriteLimiter(), and writeOrDequeue().
◆ writeLimitingActive
bool ClientInfo::writeLimitingActive |
Definition at line 69 of file ClientInfo.h.
Referenced by scheduleWrite(), BandwidthBucket::SelectBucket(), and setWriteLimiter().
◆ writeSpeedLimit
|
protectedinherited |
Definition at line 53 of file BandwidthBucket.h.
Referenced by BandwidthBucket::noLimit(), BandwidthBucket::refillBucket(), and setWriteLimiter().
The documentation for this class was generated from the following files:
- src/ClientInfo.h
- src/client_db.cc
- src/comm.cc
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products