tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_lb.c
Date Mon, 08 Mar 2004 23:01:07 GMT
truk        2004/03/08 15:01:07

  Modified:    jk/native2/common jk_worker_lb.c
  Log:
  Fix bug 23483
  
  Only add worker to the workerTable if it is not already there.
  Add check for maximum workers too.
  
  Revision  Changes    Path
  1.38      +21 -5     jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c
  
  Index: jk_worker_lb.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- jk_worker_lb.c	27 Feb 2004 08:34:18 -0000	1.37
  +++ jk_worker_lb.c	8 Mar 2004 23:01:06 -0000	1.38
  @@ -448,7 +448,8 @@
           char *name = lb->lbWorkerMap->nameAt( env, lb->lbWorkerMap, i);
           jk_worker_t *w= env->getByName( env, name );
           int level=0;
  -        int pos=0;
  +        int pos;
  +        int workerCnt;
   
           if( w== NULL ) {
               env->l->jkLog(env, env->l, JK_LOG_ERROR,
  @@ -463,12 +464,27 @@
           /* It's like disabled */
           if( level >= JK_LB_LEVELS ) continue;
   
  -        pos=lb->workerCnt[level]++;
  +        /* check if worker is already in the table */
  +        workerCnt = lb->workerCnt[level];
  +        for(pos = 0 ; pos < workerCnt ; pos++) {
  +            if( lb->workerTables[level][pos] == w ) {
  +                break;
  +            }
  +        }
  +
  +        if( pos == workerCnt ) {
  +            if( pos == JK_LB_MAX_WORKERS ) {
  +                env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +                              "lb_worker.init(): maximum lb workers reached %s\n", name);
  +                continue;
  +            }
  +            pos=lb->workerCnt[level]++;
           
  -        lb->workerTables[level][pos]=w;
  +            lb->workerTables[level][pos]=w;
   
  -        w->lb_value = w->lb_factor;
  -        w->in_error_state = JK_FALSE;
  +            w->lb_value = w->lb_factor;
  +            w->in_error_state = JK_FALSE;
  +        }
       }
       
       return JK_OK;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message