You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mt...@apache.org on 2004/09/15 14:08:33 UTC

cvs commit: httpd-2.0/server scoreboard.c

mturk       2004/09/15 05:08:33

  Modified:    server   scoreboard.c
  Log:
  Worker shared data has to be visible across all child processes,
  so remove creating that data on per-child basis.
  
  Revision  Changes    Path
  1.76      +8 -16     httpd-2.0/server/scoreboard.c
  
  Index: scoreboard.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/scoreboard.c,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- scoreboard.c	28 Jul 2004 22:50:54 -0000	1.75
  +++ scoreboard.c	15 Sep 2004 12:08:33 -0000	1.76
  @@ -104,7 +104,7 @@
       scoreboard_size += sizeof(process_score) * server_limit;
       scoreboard_size += sizeof(worker_score) * server_limit * thread_limit;
       if (lb_limit)
  -        scoreboard_size += sizeof(lb_score) * server_limit * lb_limit;
  +        scoreboard_size += sizeof(lb_score) * lb_limit;
   
       return scoreboard_size;
   }
  @@ -130,13 +130,8 @@
           more_storage += thread_limit * sizeof(worker_score);
       }
       if (lb_limit) {
  -        ap_scoreboard_image->balancers = 
  -            (lb_score **)((char*)ap_scoreboard_image + sizeof(scoreboard) +
  -                               server_limit * sizeof(worker_score *));
  -        for (i = 0; i < server_limit; i++) {
  -            ap_scoreboard_image->balancers[i] = (lb_score *)more_storage;
  -            more_storage += lb_limit * sizeof(lb_score);
  -        }
  +        ap_scoreboard_image->balancers = (lb_score *)more_storage;
  +        more_storage += lb_limit * sizeof(lb_score);
       }    
       ap_assert(more_storage == (char*)shared_score + scoreboard_size);
       ap_scoreboard_image->global->server_limit = server_limit;
  @@ -287,10 +282,8 @@
           }
           /* Clean up the lb workers data */
           if (lb_limit) {
  -            for (i = 0; i < server_limit; i++) {
  -                memset(ap_scoreboard_image->balancers[i], 0,
  -                       sizeof(lb_score) * lb_limit);
  -            }
  +            memset(ap_scoreboard_image->balancers, 0,
  +                   sizeof(lb_score) * lb_limit);
           }        
           return OK;
       }
  @@ -495,11 +488,10 @@
       return ap_scoreboard_image->global;
   }
   
  -AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int child_num, int lb_num)
  +AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int lb_num)
   {
  -    if (((child_num < 0) || (server_limit < child_num)) ||
  -        ((lb_num < 0) || (lb_limit < lb_num))) {
  +    if (((lb_num < 0) || (lb_limit < lb_num))) {
           return(NULL); /* Out of range */
       }
  -    return &ap_scoreboard_image->balancers[child_num][lb_num];
  +    return &ap_scoreboard_image->balancers[lb_num];
   }