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