summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Frederic Clere <jfclere@apache.org>2006-07-31 15:43:11 +0000
committerJean-Frederic Clere <jfclere@apache.org>2006-07-31 15:43:11 +0000
commit2518c933e06e9eb98501ade7c64cc6d9e701b262 (patch)
tree26f2bb6b6c9de4191e46e5fbe67107b7359d4b83
parent55af90f7b9b357cf0856e3d14e72b760715494b9 (diff)
downloadhttpd-2518c933e06e9eb98501ade7c64cc6d9e701b262.tar.gz
Move what belongs to the health_checker in the health checker.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/httpd-proxy-scoreboard@427145 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--modules/proxy/mod_proxy.c3
-rw-r--r--modules/proxy/mod_proxy.h1
-rw-r--r--modules/proxy/mod_proxy_health_checker.c59
-rw-r--r--modules/proxy/proxy_util.c48
4 files changed, 47 insertions, 64 deletions
diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c
index c4ceca3734..000108e6f3 100644
--- a/modules/proxy/mod_proxy.c
+++ b/modules/proxy/mod_proxy.c
@@ -1871,9 +1871,6 @@ static int proxy_post_config(apr_pool_t *pconf, apr_pool_t *plog,
/* if we have a memory provider create the comarea here */
proxy_create_comarea(pconf, s);
- /* Also fill the comarea of the health-checker */
- proxy_checkstorage_add_workers(pconf, s);
-
return OK;
}
diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h
index 961f263386..47ceb1a9a0 100644
--- a/modules/proxy/mod_proxy.h
+++ b/modules/proxy/mod_proxy.h
@@ -449,7 +449,6 @@ APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, request_status,
/* proxy_util.c */
PROXY_DECLARE(ap_slotmem_t *) proxy_create_comarea(apr_pool_t *pconf, server_rec *s);
-PROXY_DECLARE(void) proxy_checkstorage_add_workers(apr_pool_t *pconf, server_rec *s);
PROXY_DECLARE(void) proxy_lookup_storage_provider();
PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r);
diff --git a/modules/proxy/mod_proxy_health_checker.c b/modules/proxy/mod_proxy_health_checker.c
index 010a27dcdd..5a139a9efd 100644
--- a/modules/proxy/mod_proxy_health_checker.c
+++ b/modules/proxy/mod_proxy_health_checker.c
@@ -18,13 +18,14 @@ static int healthck_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp)
{
slotmem_storage_method *checkstorage;
- const health_worker_method *worker_storage = health_checker_get_storage();
+ const health_worker_method *worker_storage;
ap_slotmem_t *myscore;
checkstorage = ap_lookup_provider(SLOTMEM_STORAGE, "shared", "0");
if (checkstorage) {
health_checker_init_slotmem_storage(checkstorage);
}
+ worker_storage = ap_lookup_provider(PROXY_CKMETHOD, "default", "0");
if (checkstorage && worker_storage) {
checkstorage->ap_slotmem_create(&myscore, "proxy/checker", worker_storage->getentrysize(), 128, pconf);
health_checker_init_slotmem(myscore);
@@ -32,30 +33,64 @@ static int healthck_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
return OK;
}
-/* XXX: Was to get ap_proxy_lb_workers()
static int healthck_post_config(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
- slotmem_storage_method *checkstorage = health_checker_get_slotmem_storage();
- health_worker_method *worker_storage = health_checker_get_storage();
- ap_slotmem_t *myscore;
+ const health_worker_method *worker_storage;
+ worker_storage = ap_lookup_provider(PROXY_CKMETHOD, "default", "0");
+
+ if (worker_storage) {
+ while (s) {
+ void *sconf = s->module_config;
+ proxy_server_conf *conf;
+ proxy_worker *worker;
+ proxy_balancer *balancer;
+ int i, j, k;
- if (checkstorage && worker_storage) {
- checkstorage->ap_slotmem_create(&myscore, "proxy/checker", worker_storage->getentrysize(), ap_proxy_lb_workers(), pconf);
- health_checker_init_slotmem(myscore);
+ conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module);
+ worker = (proxy_worker *) conf->workers->elts;
+ for (i = 0; i < conf->workers->nelts; i++) {
+ const char *name = NULL;
+ /* find the balancer if any */
+ balancer = (proxy_balancer *)conf->balancers->elts;
+ for (j = 0; j< conf->balancers->nelts; j++) {
+ proxy_worker *myworker = (proxy_worker *)balancer->workers->elts;
+ for (k = 0; k < balancer->workers->nelts; k++) {
+ if (myworker->id == worker->id) {
+ name = balancer->name;
+ break;
+ }
+ myworker++;
+ }
+ if (name)
+ break;
+ }
+
+ if (!name) {
+ /* No balancer */
+ name = "None";
+ }
+ worker_storage->add_entry(worker, name, worker->id);
+ worker++;
+ }
+
+ /* XXX: Do we need something for reverse and forward */
+
+ s = s->next;
+ }
}
return OK;
-
}
- */
static void ap_healthstore_register_hook(apr_pool_t *p)
{
- static const char * const aszPos[] = { "mod_sharedmem.c", NULL };
+ static const char * const prePos[] = { "mod_sharedmem.c", NULL };
+ static const char * const postPos[] = { "mod_proxy.c", NULL };
const health_worker_method *worker_storage = health_checker_get_storage();
ap_register_provider(p, PROXY_CKMETHOD, "default", "0", worker_storage);
- ap_hook_pre_config(healthck_pre_config, NULL, aszPos, APR_HOOK_MIDDLE);
+ ap_hook_pre_config(healthck_pre_config, NULL, prePos, APR_HOOK_MIDDLE);
+ ap_hook_post_config(healthck_post_config, NULL, postPos, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA proxy_health_checker_module = {
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
index e7bec29438..f7df8b63f7 100644
--- a/modules/proxy/proxy_util.c
+++ b/modules/proxy/proxy_util.c
@@ -43,8 +43,6 @@ APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, int, create_req,
OK, DECLINED)
/* Storage for the comarea */
static const slotmem_storage_method *storage = NULL;
-/* Health checker handler */
-static const health_worker_method *checkstorage = NULL;
/* already called in the knowledge that the characters are hex digits */
PROXY_DECLARE(int) ap_proxy_hex2c(const char *x)
@@ -2247,50 +2245,4 @@ PROXY_DECLARE(void) proxy_lookup_storage_provider()
storage = ap_lookup_provider(SLOTMEM_STORAGE, "score", "0");
if (!storage)
storage = ap_lookup_provider(SLOTMEM_STORAGE, "plain", "0");
- checkstorage = ap_lookup_provider(PROXY_CKMETHOD, "default", "0");
-}
-
-/* Copy all the worker information in the comarea */
-PROXY_DECLARE(void) proxy_checkstorage_add_workers(apr_pool_t *pconf, server_rec *s)
-{
- if (checkstorage) {
- while (s) {
- void *sconf = s->module_config;
- proxy_server_conf *conf;
- proxy_worker *worker;
- proxy_balancer *balancer;
- int i, j, k;
-
- conf = (proxy_server_conf *)ap_get_module_config(sconf, &proxy_module);
- worker = (proxy_worker *) conf->workers->elts;
- for (i = 0; i < conf->workers->nelts; i++) {
- const char *name = NULL;
- /* find the balancer if any */
- balancer = (proxy_balancer *)conf->balancers->elts;
- for (j = 0; j< conf->balancers->nelts; j++) {
- proxy_worker *myworker = (proxy_worker *)balancer->workers->elts;
- for (k = 0; k < balancer->workers->nelts; k++) {
- if (myworker->id == worker->id) {
- name = balancer->name;
- break;
- }
- myworker++;
- }
- if (name)
- break;
- }
-
- if (!name) {
- /* No balancer */
- name = "None";
- }
- checkstorage->add_entry(worker, name, worker->id);
- worker++;
- }
-
- /* XXX: Do we need something for reverse and forward */
-
- s = s->next;
- }
- }
}