diff options
author | Jim Jagielski <jim@apache.org> | 2011-02-01 20:07:02 +0100 |
---|---|---|
committer | Jim Jagielski <jim@apache.org> | 2011-02-01 20:07:02 +0100 |
commit | f2c6805bc9a7d5eac6ab9004ae75af131e9999b0 (patch) | |
tree | 4cdc41ce93bdd272f7ba6a9685a3254cac21c505 /modules/proxy/proxy_util.c | |
parent | bitfields should be unsigned (diff) | |
download | apache2-f2c6805bc9a7d5eac6ab9004ae75af131e9999b0.tar.xz apache2-f2c6805bc9a7d5eac6ab9004ae75af131e9999b0.zip |
Again, abstract out the worker status magic to it's handled
by funcs...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1066138 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | modules/proxy/proxy_util.c | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 02c8e9ed16..6e0f2ce049 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -2834,10 +2834,35 @@ ap_proxy_hashfunc(const char *str, proxy_hash_t method) } } -PROXY_DECLARE(apr_status_t) ap_proxy_set_wstatus(const char c, int set, unsigned int *status) +PROXY_DECLARE(apr_status_t) ap_proxy_set_wstatus(const char c, int set, proxy_worker *w) { + unsigned int *status = &w->s->status; char bit = toupper(c); switch (bit) { + case PROXY_WORKER_INITIALIZED_FLAG : + if (set) + *status |= PROXY_WORKER_INITIALIZED; + else + *status &= ~PROXY_WORKER_INITIALIZED; + break; + case PROXY_WORKER_IGNORE_ERRORS_FLAG : + if (set) + *status |= PROXY_WORKER_IGNORE_ERRORS; + else + *status &= ~PROXY_WORKER_IGNORE_ERRORS; + break; + case PROXY_WORKER_DRAIN_FLAG : + if (set) + *status |= PROXY_WORKER_DRAIN; + else + *status &= ~PROXY_WORKER_DRAIN; + break; + case PROXY_WORKER_IN_SHUTDOWN_FLAG : + if (set) + *status |= PROXY_WORKER_IN_SHUTDOWN; + else + *status &= ~PROXY_WORKER_IN_SHUTDOWN; + break; case PROXY_WORKER_DISABLED_FLAG : if (set) *status |= PROXY_WORKER_DISABLED; @@ -2862,11 +2887,11 @@ PROXY_DECLARE(apr_status_t) ap_proxy_set_wstatus(const char c, int set, unsigned else *status &= ~PROXY_WORKER_HOT_STANDBY; break; - case PROXY_WORKER_IGNORE_ERRORS_FLAG : + case PROXY_WORKER_FREE_FLAG : if (set) - *status |= PROXY_WORKER_IGNORE_ERRORS; + *status |= PROXY_WORKER_FREE; else - *status &= ~PROXY_WORKER_IGNORE_ERRORS; + *status &= ~PROXY_WORKER_FREE; break; default: return APR_EINVAL; @@ -2874,3 +2899,32 @@ PROXY_DECLARE(apr_status_t) ap_proxy_set_wstatus(const char c, int set, unsigned } return APR_SUCCESS; } + +PROXY_DECLARE(char *) ap_proxy_parse_wstatus(apr_pool_t *p, proxy_worker *w) +{ + char *ret = NULL; + unsigned int status = w->s->status; + if (status & PROXY_WORKER_INITIALIZED) + ret = apr_pstrcat(p, "Init ", NULL); + else + ret = apr_pstrcat(p, "!Init ", NULL); + if (status & PROXY_WORKER_IGNORE_ERRORS) + ret = apr_pstrcat(p, ret, "Ign ", NULL); + if (status & PROXY_WORKER_DRAIN) + ret = apr_pstrcat(p, ret, "Drn ", NULL); + if (status & PROXY_WORKER_IN_SHUTDOWN) + ret = apr_pstrcat(p, ret, "Shut ", NULL); + if (status & PROXY_WORKER_DISABLED) + ret = apr_pstrcat(p, ret, "Dis ", NULL); + if (status & PROXY_WORKER_STOPPED) + ret = apr_pstrcat(p, ret, "Stop ", NULL); + if (status & PROXY_WORKER_IN_ERROR) + ret = apr_pstrcat(p, ret, "Err ", NULL); + if (status & PROXY_WORKER_HOT_STANDBY) + ret = apr_pstrcat(p, ret, "Stby ", NULL); + if (status & PROXY_WORKER_FREE) + ret = apr_pstrcat(p, ret, "Free ", NULL); + if (PROXY_WORKER_IS_USABLE(w)) + ret = apr_pstrcat(p, ret, "Ok ", NULL); + return ret; +} |