20 bucketLevel( sizeLimit * (initialLevelPercent / 100.0)),
22 writeSpeedLimit(speed),
23 bucketSizeLimit(sizeLimit)
37 const double timePassed = currTime -
prevTime;
54 debugs(77, 4,
"not refilling while draining initial fat");
68 const int q =
quota();
73 const int nleft_corrected =
min(nleft, q);
74 if (nleft != nleft_corrected) {
75 debugs(77, 5, state->
conn <<
" writes only " <<
76 nleft_corrected <<
" out of " << nleft);
77 nleft = nleft_corrected;
Base class for Squid-to-client bandwidth limiting.
bool noLimit() const
Whether this bucket will not do bandwidth limiting.
double bucketLevel
how much can be written now
void refillBucket()
Increases the bucket level with the writeSpeedLimit speed.
double bucketSizeLimit
maximum bucket size
BandwidthBucket(const int speed, const int initialLevelPercent, const double sizeLimit)
double prevTime
previous time when we checked
virtual bool applyQuota(int &nleft, Comm::IoCallback *state)
double writeSpeedLimit
Write speed limit in bytes per second.
static BandwidthBucket * SelectBucket(fde *f)
virtual void reduceBucket(const int len)
Decreases the bucket level.
bool writeLimitingActive
Is write limiter active.
Details about a particular Comm IO callback event.
Comm::ConnectionPointer conn
MessageBucket::Pointer writeQuotaHandler
response write limiter, if configured
ClientInfo * clientInfo
pointer to client info used in client write limiter or nullptr if not present
A const & min(A const &lhs, A const &rhs)
#define debugs(SECTION, LEVEL, CONTENT)
double current_dtime
the current UNIX time in seconds (with microsecond precision)
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval