From: Amos Jeffries Date: Sat, 19 Dec 2009 05:47:00 +0000 (+1300) Subject: Polish on-demand helpers a little more X-Git-Tag: SQUID_3_2_0_1~506 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=404cfda137ac83a6f7df3aab5d840746d634686c;p=thirdparty%2Fsquid.git Polish on-demand helpers a little more * logic for implicit external_acl_type idle= parameter was bad could result in idle=9999999 if maxparseConfig() -#define dump_HelperChildConfig(e,n,c) storeAppendPrintf((e), "\n%s %d startup=%d idle=%d\n", (n), (c).n_max, (c).n_startup, (c).n_idle) +#define dump_HelperChildConfig(e,n,c) storeAppendPrintf((e), "\n%s %d startup=%d idle=%d concurrency=%d\n", (n), (c).n_max, (c).n_startup, (c).n_idle, (c).concurrency) #define free_HelperChildConfig(dummy) // NO. #endif /* _SQUID_SRC_HELPERCHILDCONFIG_H */ diff --git a/src/auth/basic/auth_basic.cc b/src/auth/basic/auth_basic.cc index ef1bf15c23..d3bb42138d 100644 --- a/src/auth/basic/auth_basic.cc +++ b/src/auth/basic/auth_basic.cc @@ -301,8 +301,7 @@ AuthBasicConfig::dump(StoreEntry * entry, const char *name, AuthConfig * scheme) storeAppendPrintf(entry, "\n"); storeAppendPrintf(entry, "%s basic realm %s\n", name, basicAuthRealm); - storeAppendPrintf(entry, "%s basic children %d startup=%d idle=%d\n", name, authenticateChildren.n_max, authenticateChildren.n_startup, authenticateChildren.n_idle); - storeAppendPrintf(entry, "%s basic concurrency %d\n", name, authenticateConcurrency); + storeAppendPrintf(entry, "%s basic children %d startup=%d idle=%d concurrency=%d\n", name, authenticateChildren.n_max, authenticateChildren.n_startup, authenticateChildren.n_idle, authenticateChildren.concurrency); storeAppendPrintf(entry, "%s basic credentialsttl %d seconds\n", name, (int) credentialsTTL); storeAppendPrintf(entry, "%s basic casesensitive %s\n", name, casesensitive ? "on" : "off"); } @@ -331,8 +330,6 @@ AuthBasicConfig::parse(AuthConfig * scheme, int n_configured, char *param_str) requirePathnameExists("auth_param basic program", authenticate->key); } else if (strcasecmp(param_str, "children") == 0) { authenticateChildren.parseConfig(); - } else if (strcasecmp(param_str, "concurrency") == 0) { - parse_int(&authenticateConcurrency); } else if (strcasecmp(param_str, "realm") == 0) { parse_eol(&basicAuthRealm); } else if (strcasecmp(param_str, "credentialsttl") == 0) { @@ -610,8 +607,6 @@ AuthBasicConfig::init(AuthConfig * scheme) basicauthenticators->childs = authenticateChildren; - basicauthenticators->childs.concurrency = authenticateConcurrency; - basicauthenticators->ipc_type = IPC_STREAM; helperOpenServers(basicauthenticators); diff --git a/src/auth/basic/auth_basic.h b/src/auth/basic/auth_basic.h index 079addb13c..2728cf4f90 100644 --- a/src/auth/basic/auth_basic.h +++ b/src/auth/basic/auth_basic.h @@ -128,7 +128,6 @@ public: virtual void registerWithCacheManager(void); virtual const char * type() const; HelperChildConfig authenticateChildren; - int authenticateConcurrency; char *basicAuthRealm; wordlist *authenticate; time_t credentialsTTL; diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index 909ce98298..879a3c8e5e 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -532,9 +532,9 @@ AuthDigestConfig::dump(StoreEntry * entry, const char *name, AuthConfig * scheme list = list->next; } - storeAppendPrintf(entry, "\n%s %s realm %s\n%s %s children %d startup=%d idle=%d\n%s %s nonce_max_count %d\n%s %s nonce_max_duration %d seconds\n%s %s nonce_garbage_interval %d seconds\n", + storeAppendPrintf(entry, "\n%s %s realm %s\n%s %s children %d startup=%d idle=%d concurrency=%d\n%s %s nonce_max_count %d\n%s %s nonce_max_duration %d seconds\n%s %s nonce_garbage_interval %d seconds\n", name, "digest", digestAuthRealm, - name, "digest", authenticateChildren.n_max, authenticateChildren.n_startup, authenticateChildren.n_idle, + name, "digest", authenticateChildren.n_max, authenticateChildren.n_startup, authenticateChildren.n_idle, authenticateChildren.concurrency, name, "digest", noncemaxuses, name, "digest", (int) noncemaxduration, name, "digest", (int) nonceGCInterval); diff --git a/src/auth/negotiate/auth_negotiate.cc b/src/auth/negotiate/auth_negotiate.cc index 16772fb626..59da54ca0b 100644 --- a/src/auth/negotiate/auth_negotiate.cc +++ b/src/auth/negotiate/auth_negotiate.cc @@ -136,8 +136,8 @@ AuthNegotiateConfig::dump(StoreEntry * entry, const char *name, AuthConfig * sch list = list->next; } - storeAppendPrintf(entry, "\n%s negotiate children %d startup=%d idle=%d\n", - name, authenticateChildren.n_max, authenticateChildren.n_startup, authenticateChildren.n_idle); + storeAppendPrintf(entry, "\n%s negotiate children %d startup=%d idle=%d concurrency=%d\n", + name, authenticateChildren.n_max, authenticateChildren.n_startup, authenticateChildren.n_idle, authenticateChildren.concurrency); storeAppendPrintf(entry, "%s %s keep_alive %s\n", name, "negotiate", keep_alive ? "on" : "off"); } diff --git a/src/auth/ntlm/auth_ntlm.cc b/src/auth/ntlm/auth_ntlm.cc index 85fe175c07..c685dc0bdb 100644 --- a/src/auth/ntlm/auth_ntlm.cc +++ b/src/auth/ntlm/auth_ntlm.cc @@ -118,8 +118,8 @@ AuthNTLMConfig::dump(StoreEntry * entry, const char *name, AuthConfig * scheme) list = list->next; } - storeAppendPrintf(entry, "\n%s ntlm children %d startup=%d idle=%d\n", - name, authenticateChildren.n_max, authenticateChildren.n_startup, authenticateChildren.n_idle); + storeAppendPrintf(entry, "\n%s ntlm children %d startup=%d idle=%d concurrency=%d\n", + name, authenticateChildren.n_max, authenticateChildren.n_startup, authenticateChildren.n_idle, authenticateChildren.concurrency); storeAppendPrintf(entry, "%s %s keep_alive %s\n", name, "ntlm", keep_alive ? "on" : "off"); } diff --git a/src/cf.data.pre b/src/cf.data.pre index b20b455c54..79f17ff084 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -3196,7 +3196,7 @@ DOC_END NAME: url_rewrite_children redirect_children TYPE: HelperChildConfig -DEFAULT: 20 startup=0 idle=1 concurrency=0 +DEFAULT: 20 startup=0 idle=1 concurrency=1 LOC: Config.redirectChildren DOC_START The maximum number of redirector processes to spawn. If you limit diff --git a/src/external_acl.cc b/src/external_acl.cc index 2addc11b6e..a55c4a373b 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -295,7 +295,7 @@ parse_externalAclHelper(external_acl ** list) a->negative_ttl = -1; a->children.n_max = DEFAULT_EXTERNAL_ACL_CHILDREN; a->children.n_startup = a->children.n_max; - a->children.n_idle = 99999999; // big to detect if the user sets their own. + a->children.n_idle = 1; a->local_addr.SetLocalhost(); a->quote = external_acl::QUOTE_METHOD_URL; @@ -357,10 +357,15 @@ parse_externalAclHelper(external_acl ** list) token = strtok(NULL, w_space); } - /* our default idle is huge on purpose, make it sane when we know whether the user has set their own. */ - if (a->children.n_idle > a->children.n_max - a->children.n_startup) - a->children.n_idle = max(1, (int)(a->children.n_max - a->children.n_startup)); + /* check that child startup value is sane. */ + if ((a->children.n_startup > a->children.n_max) + a->children.n_startup = a->children.n_max; + /* check that child idle value is sane. */ + if (a->children.n_idle > a->children.n_max) + a->children.n_idle = a->children.n_max; + if (a->children.n_idle < 1) + a->children.n_idle = 1; if (a->negative_ttl == -1) a->negative_ttl = a->ttl;