stub_HelperChildConfig.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
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  onPersistentOverload(actDie),
27  defaultQueueSize(true)
28 {}
29 
30 Helper::ChildConfig::ChildConfig(const unsigned int m):
31  n_max(m),
32  n_startup(0),
33  n_idle(1),
34  concurrency(0),
35  n_running(0),
36  n_active(0),
37  queue_size(2 * m),
38  onPersistentOverload(actDie),
39  defaultQueueSize(true)
40 {}
41 
42 int
44 {
45  /* during the startup and reconfigure use our special amount... */
46  if (starting_up || reconfiguring) return n_startup;
47 
48  /* keep a minimum of n_idle helpers free... */
49  if ( (n_active + n_idle) < n_max) return n_idle;
50 
51  /* dont ever start more than n_max processes. */
52  return (n_max - n_active);
53 }
54 
56 Helper::ChildConfig & Helper::ChildConfig::updateLimits(const Helper::ChildConfig &) STUB_RETVAL(*this)
57 
unsigned int n_active
Definition: ChildConfig.h:86
#define STUB_RETVAL(x)
Definition: STUB.h:41
unsigned int n_max
Definition: ChildConfig.h:48
#define true
Definition: GnuRegex.c:234
unsigned int n_idle
Definition: ChildConfig.h:66
#define STUB
macro to stub a void function.
Definition: STUB.h:33
unsigned int n_startup
Definition: ChildConfig.h:57
int starting_up
int reconfiguring
int needNew() const
Definition: ChildConfig.cc:59

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors