]> git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/stub_HelperChildConfig.cc
60761e00811d7e09a0b041fe4315c5f0ba39fc93
[thirdparty/squid.git] / src / tests / stub_HelperChildConfig.cc
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 #include "squid.h"
10 #include "globals.h"
11 #include "helper/ChildConfig.h"
12
13 #define STUB_API "stub_HelperChildconfig.cc"
14 #include "tests/STUB.h"
15
16 #include <cstring>
17
18 Helper::ChildConfig::ChildConfig():
19 n_max(0),
20 n_startup(0),
21 n_idle(1),
22 concurrency(0),
23 n_running(0),
24 n_active(0),
25 queue_size(0),
26 defaultQueueSize(true)
27 {}
28
29 Helper::ChildConfig::ChildConfig(const unsigned int m):
30 n_max(m),
31 n_startup(0),
32 n_idle(1),
33 concurrency(0),
34 n_running(0),
35 n_active(0),
36 queue_size(2 * m),
37 defaultQueueSize(true)
38 {}
39
40 int
41 Helper::ChildConfig::needNew() const
42 {
43 /* during the startup and reconfigure use our special amount... */
44 if (starting_up || reconfiguring) return n_startup;
45
46 /* keep a minimum of n_idle helpers free... */
47 if ( (n_active + n_idle) < n_max) return n_idle;
48
49 /* dont ever start more than n_max processes. */
50 return (n_max - n_active);
51 }
52
53 void Helper::ChildConfig::parseConfig() STUB
54