]> git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/stub_HelperChildConfig.cc
Merge from trunk
[thirdparty/squid.git] / src / tests / stub_HelperChildConfig.cc
1 #include "squid.h"
2 #include "globals.h"
3 #include "HelperChildConfig.h"
4
5 #define STUB_API "stub_HelperChildconfig.cc"
6 #include "tests/STUB.h"
7
8 #include <cstring>
9
10 HelperChildConfig::HelperChildConfig(const unsigned int m):
11 n_max(m),
12 n_startup(0),
13 n_idle(1),
14 concurrency(0),
15 n_running(0),
16 n_active(0)
17 {}
18
19 int
20 HelperChildConfig::needNew() const
21 {
22 /* during the startup and reconfigure use our special amount... */
23 if (starting_up || reconfiguring) return n_startup;
24
25 /* keep a minimum of n_idle helpers free... */
26 if ( (n_active + n_idle) < n_max) return n_idle;
27
28 /* dont ever start more than n_max processes. */
29 return (n_max - n_active);
30 }
31
32 void HelperChildConfig::parseConfig() STUB