mturk 2004/08/09 03:10:24 Modified: ajp/proxy proxy_balancer.c Log: The lbstatus needs to be updated for every worker, not just the candidate. Revision Changes Path 1.3 +20 -8 jakarta-tomcat-connectors/ajp/proxy/proxy_balancer.c Index: proxy_balancer.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/proxy/proxy_balancer.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- proxy_balancer.c 9 Aug 2004 09:55:47 -0000 1.2 +++ proxy_balancer.c 9 Aug 2004 10:10:24 -0000 1.3 @@ -134,7 +134,7 @@ request_rec *r) { int i; - double total_status = 0.0; + double total_factor = 0.0; proxy_runtime_worker *worker = (proxy_runtime_worker *)balancer->workers->elts; proxy_runtime_worker *candidate = NULL; @@ -153,7 +153,11 @@ if (worker->w->cp->nfree > candidate->w->cp->nfree) candidate = worker; } - total_status += worker->lbstatus; + /* Total factor should allways be 100. + * This is for cases when worker is in error state. + * It will force the even request distribution + */ + total_factor += worker->lbfactor; } worker++; } @@ -204,12 +208,20 @@ } worker++; } - /* XXX: The lbfactor can be update using bytes transfered - * Right now, use the round-robin scheme - */ - candidate->lbstatus += candidate->lbfactor; - if (candidate->lbstatus >= total_status) - candidate->lbstatus = candidate->lbfactor; + for (i = 0; i < balancer->workers->nelts; i++) { + /* If the worker is not error state + * or not in disabled mode + */ + if (worker->w->status > 2) { + /* XXX: The lbfactor can be update using bytes transfered + * Right now, use the round-robin scheme + */ + worker->lbstatus += worker->lbfactor; + if (worker->lbstatus >= total_factor) + worker->lbstatus = worker->lbfactor; + } + worker++; + } } return candidate; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]