]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/HelperChildConfig.cc
3 #include "ConfigParser.h"
6 #include "HelperChildConfig.h"
11 HelperChildConfig::HelperChildConfig(const unsigned int m
):
21 HelperChildConfig::updateLimits(const HelperChildConfig
&rhs
)
23 // Copy the limits only.
24 // Preserve the local state values (n_running and n_active)
26 n_startup
= rhs
.n_startup
;
28 concurrency
= rhs
.concurrency
;
33 HelperChildConfig::needNew() const
35 /* during the startup and reconfigure use our special amount... */
36 if (starting_up
|| reconfiguring
) return n_startup
;
38 /* keep a minimum of n_idle helpers free... */
39 if ( (n_active
+ n_idle
) < n_max
) return n_idle
;
41 /* dont ever start more than n_max processes. */
42 return (n_max
- n_active
);
46 HelperChildConfig::parseConfig()
48 char const *token
= ConfigParser::NextToken();
53 /* starts with a bare number for the max... back-compatible */
54 n_max
= xatoui(token
);
57 debugs(0, DBG_CRITICAL
, "ERROR: The maximum number of processes cannot be less than 1.");
61 /* Parse extension options */
62 for (; (token
= ConfigParser::NextToken()) ;) {
63 if (strncmp(token
, "startup=", 8) == 0) {
64 n_startup
= xatoui(token
+ 8);
65 } else if (strncmp(token
, "idle=", 5) == 0) {
66 n_idle
= xatoui(token
+ 5);
68 debugs(0, DBG_CRITICAL
, "WARNING OVERIDE: Using idle=0 for helpers causes request failures. Overiding to use idle=1 instead.");
71 } else if (strncmp(token
, "concurrency=", 12) == 0) {
72 concurrency
= xatoui(token
+ 12);
74 debugs(0, DBG_PARSE_NOTE(DBG_IMPORTANT
), "ERROR: Undefined option: " << token
<< ".");
81 if (n_startup
> n_max
) {
82 debugs(0, DBG_CRITICAL
, "WARNING OVERIDE: Capping startup=" << n_startup
<< " to the defined maximum (" << n_max
<<")");
87 debugs(0, DBG_CRITICAL
, "WARNING OVERIDE: Capping idle=" << n_idle
<< " to the defined maximum (" << n_max
<<")");