From: Alex Rousskov Date: Mon, 5 Jul 2010 22:12:51 +0000 (-0600) Subject: Renamed "main_processes" to "workers" per Squid Project review. X-Git-Tag: SQUID_3_2_0_1~93^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=13aeac35787c00909219bba3cd41a32e3b10d0b9;p=thirdparty%2Fsquid.git Renamed "main_processes" to "workers" per Squid Project review. --- diff --git a/src/cf.data.pre b/src/cf.data.pre index 8b780b1e37..945b806c5e 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -6844,15 +6844,18 @@ DOC_START Whether to lookup the EUI or MAC address of a connected client. DOC_END -NAME: main_processes +NAME: workers TYPE: int -LOC: Config.main_processes +LOC: Config.workers DEFAULT: 1 DOC_START - Number of main Squid processes to fork. + Number of main Squid processes or "workers" to fork and maintain. 0: "no daemon" mode, like running "squid -N ..." 1: "no SMP" mode, start one main Squid process daemon (default) - N: start N main Squid process daemons + N: start N main Squid process daemons (i.e., SMP mode) + + In SMP mode, each worker does nearly all what a single Squid daemon + does (e.g., listen on http_port and forward HTTP requests). DOC_END EOF diff --git a/src/main.cc b/src/main.cc index 892bc85038..554d061060 100644 --- a/src/main.cc +++ b/src/main.cc @@ -745,16 +745,16 @@ mainReconfigureFinish(void *) Config2.onoff.enable_purge = 2; // parse the config returns a count of errors encountered. - const int oldMainProcesses = Config.main_processes; + const int oldWorkers = Config.workers; if ( parseConfigFile(ConfigFile) != 0) { // for now any errors are a fatal condition... self_destruct(); } - if (oldMainProcesses != Config.main_processes) { - debugs(1, DBG_CRITICAL, "WARNING: Changing 'main_processes' (from " << - oldMainProcesses << " to " << Config.main_processes << + if (oldWorkers != Config.workers) { + debugs(1, DBG_CRITICAL, "WARNING: Changing 'workers' (from " << + oldWorkers << " to " << Config.workers << ") is not supported and ignored"); - Config.main_processes = oldMainProcesses; + Config.workers = oldWorkers; } setUmask(Config.umask); @@ -1375,7 +1375,7 @@ SquidMain(int argc, char **argv) return 0; } - if (!opt_no_daemon && Config.main_processes > 0) + if (!opt_no_daemon && Config.workers > 0) watch_child(argv); setMaxFD(); @@ -1638,12 +1638,12 @@ watch_child(char *argv[]) dup2(nullfd, 2); } - if (Config.main_processes > 128) { - syslog(LOG_ALERT, "Suspiciously high main_processes value: %d", - Config.main_processes); + if (Config.workers > 128) { + syslog(LOG_ALERT, "Suspiciously high workers value: %d", + Config.workers); // but we keep going in hope that user knows best } - TheKids.init(Config.main_processes); + TheKids.init(Config.workers); // keep [re]starting kids until it is time to quit for (;;) { diff --git a/src/structs.h b/src/structs.h index e96faeb158..09806d0049 100644 --- a/src/structs.h +++ b/src/structs.h @@ -617,7 +617,7 @@ struct SquidConfig { char *accept_filter; int umask; - int main_processes; + int workers; #if USE_LOADABLE_MODULES wordlist *loadable_module_names; diff --git a/src/tools.cc b/src/tools.cc index 8b2e45f43f..50768dbe52 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -814,34 +814,34 @@ bool IamWorkerProcess() { // when there is only one process, it has to be the worker - if (opt_no_daemon || Config.main_processes == 0) + if (opt_no_daemon || Config.workers == 0) return true; - return 0 < KidIdentifier && KidIdentifier <= Config.main_processes; + return 0 < KidIdentifier && KidIdentifier <= Config.workers; } bool UsingSmp() { - return !opt_no_daemon && Config.main_processes > 1; + return !opt_no_daemon && Config.workers > 1; } bool IamCoordinatorProcess() { - return UsingSmp() && KidIdentifier == Config.main_processes + 1; + return UsingSmp() && KidIdentifier == Config.workers + 1; } bool IamPrimaryProcess() { // when there is only one process, it has to be primary - if (opt_no_daemon || Config.main_processes == 0) + if (opt_no_daemon || Config.workers == 0) return true; // when there is a master and worker process, the master delegates // primary functions to its only kid - if (Config.main_processes == 1) + if (Config.workers == 1) return IamWorkerProcess(); // in SMP mode, multiple kids delegate primary functions to the coordinator