]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ClientDelayConfig.cc
3 #include "ConfigParser.h"
4 #include "ClientDelayConfig.h"
8 #include "acl/Gadgets.h"
10 void ClientDelayPool::dump(StoreEntry
* entry
, unsigned int poolNumberMinusOne
) const
12 LOCAL_ARRAY(char, nom
, 32);
13 snprintf(nom
, 32, "client_delay_access %d", poolNumberMinusOne
+ 1);
14 dump_acl_access(entry
, nom
, access
);
15 storeAppendPrintf(entry
, "client_delay_parameters %d %d %"PRId64
"\n", poolNumberMinusOne
+ 1, rate
,highwatermark
);
16 storeAppendPrintf(entry
, "\n");
20 ClientDelayConfig::finalize()
22 for (unsigned int i
= 0; i
< pools
.size(); ++i
) {
23 /* pools require explicit 'allow' to assign a client into them */
24 if (!pools
[i
].access
) {
25 debugs(77, DBG_IMPORTANT
, "client_delay_pool #" << (i
+1) <<
26 " has no client_delay_access configured. " <<
27 "No client will ever use it.");
32 void ClientDelayConfig::freePoolCount()
37 void ClientDelayConfig::dumpPoolCount(StoreEntry
* entry
, const char *name
) const
40 storeAppendPrintf(entry
, "%s %d\n", name
, (int)pools
.size());
41 for (unsigned int i
= 0; i
< pools
.size(); i
++)
42 pools
[i
].dump(entry
, i
);
46 void ClientDelayConfig::parsePoolCount()
49 debugs(3, 0, "parse_client_delay_pool_count: multiple client_delay_pools lines, aborting all previous client_delay_pools config");
53 ConfigParser::ParseUShort(&pools_
);
54 for (int i
= 0; i
< pools_
; i
++) {
55 pools
.push_back(ClientDelayPool());
59 void ClientDelayConfig::parsePoolRates()
62 ConfigParser::ParseUShort(&pool
);
64 if (pool
< 1 || pool
> pools
.size()) {
65 debugs(3, 0, "parse_client_delay_pool_rates: Ignoring pool " << pool
<< " not in 1 .. " << pools
.size());
71 pools
[pool
].rate
= GetInteger();
72 pools
[pool
].highwatermark
= GetInteger64();
75 void ClientDelayConfig::parsePoolAccess(ConfigParser
&parser
)
79 ConfigParser::ParseUShort(&pool
);
81 if (pool
< 1 || pool
> pools
.size()) {
82 debugs(3, 0, "parse_client_delay_pool_rates: Ignoring pool " << pool
<< " not in 1 .. " << pools
.size());
87 aclParseAccessLine(parser
, &pools
[pool
].access
);
90 void ClientDelayConfig::clean()
92 for (unsigned int i
= 0; i
< pools
.size(); i
++) {
93 aclDestroyAccessList(&pools
[i
].access
);