]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/DelaySpec.cc
2 * Copyright (C) 1996-2018 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 */
15 #include "DelaySpec.h"
19 DelaySpec::DelaySpec() : restore_bps(-1), max_bytes (-1)
23 DelaySpec::stats (StoreEntry
* sentry
, char const *label
) const
25 if (restore_bps
== -1) {
26 storeAppendPrintf(sentry
, "\t%s:\n\t\tDisabled.\n\n", label
);
30 storeAppendPrintf(sentry
, "\t%s:\n", label
);
31 storeAppendPrintf(sentry
, "\t\tMax: %" PRId64
"\n", max_bytes
);
32 storeAppendPrintf(sentry
, "\t\tRestore: %d\n", restore_bps
);
36 DelaySpec::dump (StoreEntry
*entry
) const
38 storeAppendPrintf(entry
, " %d/%" PRId64
"", restore_bps
, max_bytes
);
45 char *token
= ConfigParser::NextToken();
52 if (strcmp(token
, "none") == 0 || token
[0] == '-') {
58 // parse the first digits into restore_bps
60 if (!StringToInt(token
, restore_bps
, &p
, 10) || *p
!= '/') {
61 debugs(77, DBG_CRITICAL
, "ERROR: invalid delay rate '" << token
<< "'. Expecting restore/max or 'none'.");
64 p
++; // increment past the '/'
66 // parse the rest into max_bytes
67 if (!StringToInt64(p
, max_bytes
, NULL
, 10)) {
68 debugs(77, DBG_CRITICAL
, "ERROR: restore rate in '" << token
<< "' is not a number.");