You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jf...@apache.org on 2006/07/31 17:43:12 UTC
svn commit: r427145 - in
/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy: mod_proxy.c
mod_proxy.h mod_proxy_health_checker.c proxy_util.c
Author: jfclere
Date: Mon Jul 31 08:43:11 2006
New Revision: 427145
URL: http://svn.apache.org/viewvc?rev=427145&view=rev
Log:
Move what belongs to the health_checker in the health checker.
Modified:
httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.c
httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h
httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c
httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c
Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.c?rev=427145&r1=427144&r2=427145&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.c Mon Jul 31 08:43:11 2006
@@ -1871,9 +1871,6 @@
/* 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;
}
Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h?rev=427145&r1=427144&r2=427145&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy.h Mon Jul 31 08:43:11 2006
@@ -449,7 +449,6 @@
/* 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);
Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c?rev=427145&r1=427144&r2=427145&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/mod_proxy_health_checker.c Mon Jul 31 08:43:11 2006
@@ -18,13 +18,14 @@
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 @@
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 = {
Modified: httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c?rev=427145&r1=427144&r2=427145&view=diff
==============================================================================
--- httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/httpd-proxy-scoreboard/modules/proxy/proxy_util.c Mon Jul 31 08:43:11 2006
@@ -43,8 +43,6 @@
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 @@
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;
- }
- }
}