Author: jfrederic.clere(a)jboss.com
Date: 2008-04-30 05:19:58 -0400 (Wed, 30 Apr 2008)
New Revision: 1569
Modified:
sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Prevent zero divisions.
Modified: sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-04-30 09:18:36 UTC
(rev 1568)
+++ sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-04-30 09:19:58 UTC
(rev 1569)
@@ -512,8 +512,11 @@
* not in error state or not disabled.
*/
if (PROXY_WORKER_IS_USABLE(worker) && iscontext_host_ok(r,
balancer, worker)) {
- mytraffic = (worker->s->transferred/worker->s->lbfactor)
+
- (worker->s->read/worker->s->lbfactor);
+ if (worker->s->lbfactor <= 0)
+ mytraffic = curmin;
+ else
+ mytraffic =
(worker->s->transferred/worker->s->lbfactor) +
+ (worker->s->read/worker->s->lbfactor);
if (!mycandidate || mytraffic < curmin) {
mycandidate = worker;
curmin = mytraffic;
@@ -846,6 +849,8 @@
/* search for the worker */
worker = (proxy_worker *)conf->workers->elts;
for (i = 0; i < conf->workers->nelts; i++) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "proxy_cluster_isup: %d JVMRoute: %s", worker->id,
worker->s->route);
if (worker->id == id)
break;
}
Show replies by date