]>
Commit | Line | Data |
---|---|---|
b67e2c8c | 1 | /* |
b8ae064d | 2 | * Copyright (C) 1996-2023 The Squid Software Foundation and contributors |
26ac0430 | 3 | * |
bbc27441 AJ |
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. | |
b67e2c8c | 7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 77 Delay Pools */ |
10 | ||
f7f3304a | 11 | #include "squid.h" |
b67e2c8c | 12 | |
9a0a18de | 13 | #if USE_DELAY_POOLS |
582c2af2 FC |
14 | #include "acl/Acl.h" |
15 | #include "acl/Gadgets.h" | |
a80a77cf | 16 | #include "ConfigParser.h" |
582c2af2 | 17 | #include "DelayConfig.h" |
b67e2c8c | 18 | #include "DelayPool.h" |
582c2af2 | 19 | #include "DelayPools.h" |
b67e2c8c | 20 | #include "Store.h" |
21 | ||
22 | void | |
23 | DelayConfig::parsePoolCount() | |
24 | { | |
f45dd259 | 25 | unsigned short pools_; |
b67e2c8c | 26 | ConfigParser::ParseUShort(&pools_); |
27 | DelayPools::pools(pools_); | |
28 | } | |
29 | ||
30 | void | |
31 | DelayConfig::parsePoolClass() | |
32 | { | |
f45dd259 | 33 | unsigned short pool; |
b67e2c8c | 34 | |
35 | ConfigParser::ParseUShort(&pool); | |
62e76326 | 36 | |
b67e2c8c | 37 | if (pool < 1 || pool > DelayPools::pools()) { |
fa84c01d | 38 | debugs(3, DBG_CRITICAL, "parse_delay_pool_class: Ignoring pool " << pool << " not in 1 .. " << DelayPools::pools()); |
62e76326 | 39 | return; |
b67e2c8c | 40 | } |
62e76326 | 41 | |
f45dd259 | 42 | unsigned short delay_class_; |
b67e2c8c | 43 | ConfigParser::ParseUShort(&delay_class_); |
62e76326 | 44 | |
1e5562e3 | 45 | if (delay_class_ < 1 || delay_class_ > 5) { |
fa84c01d | 46 | debugs(3, DBG_CRITICAL, "parse_delay_pool_class: Ignoring pool " << pool << " class " << delay_class_ << " not in 1 .. 5"); |
62e76326 | 47 | return; |
b67e2c8c | 48 | } |
62e76326 | 49 | |
5e263176 | 50 | --pool; |
b67e2c8c | 51 | |
52 | DelayPools::delay_data[pool].createPool(delay_class_); | |
53 | } | |
54 | ||
55 | void | |
56 | DelayConfig::parsePoolRates() | |
57 | { | |
f45dd259 | 58 | unsigned short pool; |
b67e2c8c | 59 | ConfigParser::ParseUShort(&pool); |
62e76326 | 60 | |
b67e2c8c | 61 | if (pool < 1 || pool > DelayPools::pools()) { |
fa84c01d | 62 | debugs(3, DBG_CRITICAL, "parse_delay_pool_rates: Ignoring pool " << pool << " not in 1 .. " << DelayPools::pools()); |
62e76326 | 63 | return; |
b67e2c8c | 64 | } |
62e76326 | 65 | |
5e263176 | 66 | --pool; |
b67e2c8c | 67 | |
68 | if (!DelayPools::delay_data[pool].theComposite().getRaw()) { | |
fa84c01d | 69 | debugs(3, DBG_CRITICAL, "parse_delay_pool_rates: Ignoring pool " << pool + 1 << " attempt to set rates with class not set"); |
62e76326 | 70 | return; |
b67e2c8c | 71 | } |
62e76326 | 72 | |
b67e2c8c | 73 | DelayPools::delay_data[pool].parse(); |
74 | } | |
75 | ||
76 | void | |
a9f20260 | 77 | DelayConfig::parsePoolAccess(ConfigParser &parser) |
b67e2c8c | 78 | { |
f45dd259 | 79 | unsigned short pool; |
b67e2c8c | 80 | |
81 | ConfigParser::ParseUShort(&pool); | |
62e76326 | 82 | |
b67e2c8c | 83 | if (pool < 1 || pool > DelayPools::pools()) { |
fa84c01d | 84 | debugs(3, DBG_CRITICAL, "parse_delay_pool_rates: Ignoring pool " << pool << " not in 1 .. " << DelayPools::pools()); |
62e76326 | 85 | return; |
b67e2c8c | 86 | } |
62e76326 | 87 | |
b67e2c8c | 88 | --pool; |
6f58d7d7 | 89 | aclParseAccessLine("delay_access", parser, &DelayPools::delay_data[pool].access); |
b67e2c8c | 90 | } |
91 | ||
92 | void | |
93 | DelayConfig::freePoolCount() | |
94 | { | |
95 | DelayPools::FreePools(); | |
96 | initial = 50; | |
97 | } | |
98 | ||
99 | void | |
100 | DelayConfig::dumpPoolCount(StoreEntry * entry, const char *name) const | |
101 | { | |
102 | int i; | |
103 | ||
104 | if (!DelayPools::pools()) { | |
62e76326 | 105 | storeAppendPrintf(entry, "%s 0\n", name); |
106 | return; | |
b67e2c8c | 107 | } |
62e76326 | 108 | |
b67e2c8c | 109 | storeAppendPrintf(entry, "%s %d\n", name, DelayPools::pools()); |
62e76326 | 110 | |
95dc7ff4 | 111 | for (i = 0; i < DelayPools::pools(); ++i) |
62e76326 | 112 | DelayPools::delay_data[i].dump (entry, i); |
b67e2c8c | 113 | } |
62e76326 | 114 | |
9a0a18de | 115 | #endif /* USE_DELAY_POOLS */ |
f53969cc | 116 |