summaryrefslogtreecommitdiffstats
path: root/modules/proxy/balancers/mod_lbmethod_bytraffic.c
diff options
context:
space:
mode:
authorJean-Frederic Clere <jfclere@apache.org>2009-05-05 19:15:48 +0200
committerJean-Frederic Clere <jfclere@apache.org>2009-05-05 19:15:48 +0200
commita29e9ec1d5d0d8226eef194b5296b5186b8784ca (patch)
tree65a1323a83bf522e08754f346bf5dea61b63c311 /modules/proxy/balancers/mod_lbmethod_bytraffic.c
parentExplain empty code block (empty for now, that is) :) (diff)
downloadapache2-a29e9ec1d5d0d8226eef194b5296b5186b8784ca.tar.xz
apache2-a29e9ec1d5d0d8226eef194b5296b5186b8784ca.zip
Change the order of mod_proxy and mod_proxy_balancer child_init().
Change the balancer workers area to the address of workers instead copying the workers. Arrange lbmethod accordingly. Move the creation of conf->forward worker to mod_proxy child_init(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@771940 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/proxy/balancers/mod_lbmethod_bytraffic.c')
-rw-r--r--modules/proxy/balancers/mod_lbmethod_bytraffic.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/modules/proxy/balancers/mod_lbmethod_bytraffic.c b/modules/proxy/balancers/mod_lbmethod_bytraffic.c
index e2b339a8e8..2c231d0e33 100644
--- a/modules/proxy/balancers/mod_lbmethod_bytraffic.c
+++ b/modules/proxy/balancers/mod_lbmethod_bytraffic.c
@@ -45,7 +45,7 @@ static proxy_worker *find_best_bytraffic(proxy_balancer *balancer,
int i;
apr_off_t mytraffic = 0;
apr_off_t curmin = 0;
- proxy_worker *worker;
+ proxy_worker **worker;
proxy_worker *mycandidate = NULL;
int cur_lbset = 0;
int max_lbset = 0;
@@ -60,15 +60,15 @@ static proxy_worker *find_best_bytraffic(proxy_balancer *balancer,
do {
checking_standby = checked_standby = 0;
while (!mycandidate && !checked_standby) {
- worker = (proxy_worker *)balancer->workers->elts;
+ worker = (proxy_worker **)balancer->workers->elts;
for (i = 0; i < balancer->workers->nelts; i++, worker++) {
if (!checking_standby) { /* first time through */
- if (worker->s->lbset > max_lbset)
- max_lbset = worker->s->lbset;
+ if ((*worker)->s->lbset > max_lbset)
+ max_lbset = (*worker)->s->lbset;
}
- if (worker->s->lbset != cur_lbset)
+ if ((*worker)->s->lbset != cur_lbset)
continue;
- if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
+ if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(*worker) : PROXY_WORKER_IS_STANDBY(*worker)) )
continue;
/* If the worker is in error state run
* retry on that worker. It will be marked as
@@ -76,16 +76,16 @@ static proxy_worker *find_best_bytraffic(proxy_balancer *balancer,
* The worker might still be unusable, but we try
* anyway.
*/
- if (!PROXY_WORKER_IS_USABLE(worker))
- ap_proxy_retry_worker("BALANCER", worker, r->server);
+ if (!PROXY_WORKER_IS_USABLE(*worker))
+ ap_proxy_retry_worker("BALANCER", *worker, r->server);
/* Take into calculation only the workers that are
* not in error state or not disabled.
*/
- if (PROXY_WORKER_IS_USABLE(worker)) {
- mytraffic = (worker->s->transferred/worker->s->lbfactor) +
- (worker->s->read/worker->s->lbfactor);
+ if (PROXY_WORKER_IS_USABLE(*worker)) {
+ mytraffic = ((*worker)->s->transferred/(*worker)->s->lbfactor) +
+ ((*worker)->s->read/(*worker)->s->lbfactor);
if (!mycandidate || mytraffic < curmin) {
- mycandidate = worker;
+ mycandidate = *worker;
curmin = mytraffic;
}
}