]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/DelayBucket.cc
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 77 Delay Pools */
14 #include "DelayBucket.h"
15 #include "DelaySpec.h"
16 #include "SquidConfig.h"
20 DelayBucket::stats(StoreEntry
*entry
)const
22 storeAppendPrintf(entry
, "%d", level());
26 DelayBucket::update(DelaySpec
const &rate
, int incr
)
28 if (rate
.restore_bps
!= -1 &&
29 (level() += rate
.restore_bps
* incr
) > rate
.max_bytes
)
30 level() = rate
.max_bytes
;
34 DelayBucket::bytesWanted(int minimum
, int maximum
) const
36 int result
= max(minimum
, min(maximum
, level()));
41 DelayBucket::bytesIn(int qty
)
47 DelayBucket::init(DelaySpec
const &rate
)
49 level() = (int) (((double)rate
.max_bytes
*
50 Config
.Delay
.initial
) / 100);
53 #endif /* USE_DELAY_POOLS */