#include <ClientInfo.h>

Inheritance diagram for ClientInfo:
Collaboration diagram for ClientInfo:

Classes

struct  Cutoff
 
struct  Protocol
 

Public Member Functions

 ClientInfo (const Ip::Address &)
 
 ~ClientInfo ()
 
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
 retuns 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 ()
 schedule commHandleWriteHelper call More...
 
virtual int quota () override
 allocate quota for a just dequeued client More...
 
virtual bool applyQuota (int &nleft, Comm::IoCallback *state) override
 
virtual void scheduleWrite (Comm::IoCallback *state) override
 Will plan another write call. More...
 
virtual void onFdClosed () override
 Performs cleanup when the related file descriptor becomes closed. More...
 
virtual 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 BandwidthBucketSelectBucket (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...
 
CommQuotaQueuequotaQueue
 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_linknext
 
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::ClientInfo ( const Ip::Address ip)
explicit

Definition at line 55 of file client_db.cc.

References addr, buf, debugs, hash_link::key, MAX_IPSTRLEN, Ip::Address::toStr(), and xmalloc.

ClientInfo::~ClientInfo ( )

Definition at line 336 of file client_db.cc.

References debugs, hash_link::key, NULL, quotaQueue, and safe_free.

Member Function Documentation

bool ClientInfo::applyQuota ( int nleft,
Comm::IoCallback state 
)
overridevirtual

Adjusts nleft to not exceed the current bucket quota value, if needed.

Reimplemented from BandwidthBucket.

Definition at line 1374 of file comm.cc.

References BandwidthBucket::applyQuota(), assert, Comm::IoCallback::conn, Comm::Connection::fd, hasQueue(), kickQuotaQueue(), quotaDequeue(), quotaEnqueue(), quotaPeekFd(), and Comm::IoCallback::quotaQueueReserv.

bool ClientInfo::hasQueue ( ) const

Definition at line 1284 of file comm.cc.

References assert, CommQuotaQueue::empty(), and quotaQueue.

Referenced by applyQuota(), commHandleWriteHelper(), and kickQuotaQueue().

bool ClientInfo::hasQueue ( const CommQuotaQueue q) const

Definition at line 1291 of file comm.cc.

References assert, and quotaQueue.

ClientInfo::MEMPROXY_CLASS ( ClientInfo  )
private
bool BandwidthBucket::noLimit ( ) const
inlineinherited
void ClientInfo::onFdClosed ( )
overridevirtual

Reimplemented from BandwidthBucket.

Definition at line 1397 of file comm.cc.

References kickQuotaQueue(), and BandwidthBucket::onFdClosed().

int ClientInfo::quota ( )
overridevirtual

calculates how much to write for a single dequeued client

Implements BandwidthBucket.

Definition at line 1343 of file comm.cc.

References BandwidthBucket::bucketLevel, debugs, HERE(), last_seen, quotaQueue, rationedCount, rationedQuota, BandwidthBucket::refillBucket(), CommQuotaQueue::size(), and squid_curtime.

void ClientInfo::quotaDequeue ( )

removes queue head

Definition at line 1323 of file comm.cc.

References assert, CommQuotaQueue::dequeue(), and quotaQueue.

Referenced by applyQuota(), and commHandleWriteHelper().

void ClientInfo::quotaDumpQueue ( )
unsigned int ClientInfo::quotaEnqueue ( int  fd)

queues a given fd, creating the queue if necessary; returns reservation ID

Definition at line 1315 of file comm.cc.

References assert, CommQuotaQueue::enqueue(), and quotaQueue.

Referenced by applyQuota(), and scheduleWrite().

int ClientInfo::quotaPeekFd ( ) const

returns the first descriptor to be dequeued

Definition at line 1299 of file comm.cc.

References assert, CommQuotaQueue::front(), and quotaQueue.

Referenced by applyQuota(), and commHandleWriteHelper().

unsigned int ClientInfo::quotaPeekReserv ( ) const

returns the reservation ID of the first descriptor to be dequeued

Definition at line 1307 of file comm.cc.

References assert, CommQuotaQueue::outs, and quotaQueue.

Referenced by commHandleWriteHelper().

void ClientInfo::reduceBucket ( int  len)
overridevirtual

Reimplemented from BandwidthBucket.

Definition at line 1405 of file comm.cc.

References kickQuotaQueue(), and BandwidthBucket::reduceBucket().

void ClientInfo::scheduleWrite ( Comm::IoCallback state)
overridevirtual
BandwidthBucket * BandwidthBucket::SelectBucket ( fde f)
staticinherited
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 vavlue and configured initial bucket value(50% by default).

Parameters
writeSpeedLimitis speed limit configured in config for this pool
initialBurstis initial bucket size to use for this client(i.e. client can burst at first)
highWatermarkis maximum bucket value

Definition at line 1414 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().

Member Data Documentation

Ip::Address ClientInfo::addr

Definition at line 41 of file ClientInfo.h.

Referenced by client_entry(), clientdbDump(), ClientInfo(), and snmp_meshCtblFn().

double BandwidthBucket::bucketLevel
inherited
double BandwidthBucket::bucketSizeLimit
protectedinherited

Definition at line 54 of file BandwidthBucket.h.

Referenced by BandwidthBucket::refillBucket(), and setWriteLimiter().

struct ClientInfo::Cutoff ClientInfo::cutoff

Referenced by clientdbCutoffDenied().

bool ClientInfo::eventWaiting

Definition at line 71 of file ClientInfo.h.

Referenced by commHandleWriteHelper(), and kickQuotaQueue().

bool ClientInfo::firstTimeConnection

Definition at line 66 of file ClientInfo.h.

Referenced by setWriteLimiter().

void* hash_link::key
inherited

Definition at line 19 of file hash.h.

Referenced by aclMatchExternal(), MemStore::anchorCollapsed(), Rock::SwapDir::anchorCollapsed(), cacheIndexCmp(), StoreMetaMD5::checkConsistency(), StoreEntry::clearPublicKeyScope(), ClientInfo(), Transients::copyFromShm(), Rock::SwapDir::createStoreIO(), CommQuotaQueue::dequeue(), destroyStoreEntry(), LeakFinder::dump(), CommQuotaQueue::enqueue(), external_acl_cache_add(), StoreEntry::forcePublicKey(), fqdncache_entry::fqdncache_entry(), fqdncacheAddEntry(), fqdncacheParse(), StoreEntry::getMD5Text(), hash_join(), hash_lookup(), hash_remove_link(), hash_unlink(), StoreEntry::hashDelete(), StoreEntry::hashInsert(), hashKeyStr(), htcpQuery(), IdleConnList::IdleConnList(), idnsStartQuery(), ipcache_entry::ipcache_entry(), ipcacheAddEntry(), ipcacheRelease(), LeakFinderPtr::LeakFinderPtr(), Fs::Ufs::UFSSwapDir::logEntry(), my_free(), ipcache_entry::name(), neighborsUdpPing(), net_db_name::net_db_name(), netdbHashInsert(), Ipc::StoreMap::openForUpdating(), Rock::SwapDir::openStoreIO(), peerCountMcastPeersStart(), read_passwd_file(), Ipc::StoreMapAnchor::set(), StoreEntry::setPrivateKey(), StoreEntry::setPublicKey(), setWriteLimiter(), Ident::Start(), MemStore::startCaching(), Transients::startWriting(), storeDigestAdd(), storeDigestDel(), storeRebuildParseEntry(), storeSwapMetaBuild(), MemStore::unlink(), UFSCleanLog::write(), ~ClientInfo(), ExternalACLEntry::~ExternalACLEntry(), fqdncache_entry::~fqdncache_entry(), IdleConnList::~IdleConnList(), and net_db_name::~net_db_name().

time_t ClientInfo::last_seen

Definition at line 63 of file ClientInfo.h.

Referenced by clientdbGC(), clientdbUpdate(), and quota().

int ClientInfo::n_established

Definition at line 62 of file ClientInfo.h.

Referenced by clientdbDump(), clientdbEstablished(), and clientdbGC().

double BandwidthBucket::prevTime
protectedinherited
int ClientInfo::rationedCount

Definition at line 70 of file ClientInfo.h.

Referenced by quota().

int ClientInfo::rationedQuota

Definition at line 69 of file ClientInfo.h.

Referenced by quota().

bool BandwidthBucket::selectWaiting
inherited
bool ClientInfo::writeLimitingActive

Definition at line 65 of file ClientInfo.h.

Referenced by scheduleWrite(), BandwidthBucket::SelectBucket(), and setWriteLimiter().

double BandwidthBucket::writeSpeedLimit
protectedinherited

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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors