]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/HelperChildConfig.cc
71c00442fe4b1d5edd66392e1d48b1daeb36f522
2 #include "HelperChildConfig.h"
7 HelperChildConfig::HelperChildConfig(const unsigned int m
):
17 HelperChildConfig::updateLimits(const HelperChildConfig
&rhs
)
19 // Copy the limits only.
20 // Preserve the local state values (n_running and n_active)
22 n_startup
= rhs
.n_startup
;
24 concurrency
= rhs
.concurrency
;
29 HelperChildConfig::needNew() const
31 /* during the startup and reconfigure use our special amount... */
32 if (starting_up
|| reconfiguring
) return n_startup
;
34 /* keep a minimum of n_idle helpers free... */
35 if ( (n_active
+ n_idle
) < n_max
) return n_idle
;
37 /* dont ever start more than n_max processes. */
38 return (n_max
- n_active
);
42 HelperChildConfig::parseConfig()
44 char const *token
= strtok(NULL
, w_space
);
49 /* starts with a bare number for the max... back-compatible */
55 /* Parse extension options */
56 for (; (token
= strtok(NULL
, w_space
)) ;) {
57 if (strncmp(token
, "startup=", 8) == 0) {
58 n_startup
= atoi(token
+ 8);
59 } else if (strncmp(token
, "idle=", 5) == 0) {
60 n_idle
= atoi(token
+ 5);
62 debugs(0,0,"WARNING OVERIDE: Using idle=0 for helpers causes request failures. Overiding to use idle=1 instead.");
65 } else if (strncmp(token
, "concurrency=", 12) == 0) {
66 concurrency
= atoi(token
+ 12);
74 if (n_startup
> n_max
) {
75 debugs(0,0,"WARNING OVERIDE: Capping startup=" << n_startup
<< " to the defined maximum (" << n_max
<<")");
80 debugs(0,0,"WARNING OVERIDE: Capping idle=" << n_idle
<< " to the defined maximum (" << n_max
<<")");