]> granicus.if.org Git - apache/commitdiff
* Do not reset lbstatus, lbfactor and lbset if the shared proxy_worker_stat
authorRuediger Pluem <rpluem@apache.org>
Tue, 11 Sep 2007 06:38:16 +0000 (06:38 +0000)
committerRuediger Pluem <rpluem@apache.org>
Tue, 11 Sep 2007 06:38:16 +0000 (06:38 +0000)
  structure for a worker is already initialized by the same or another
  process.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@574485 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_balancer.c

index 9d9c1fc5603a080dcf9a983aebee0f57300ff6f7..6258509505d30f3b6adfeb2ecedba0ff89460904 100644 (file)
@@ -19,6 +19,7 @@
 #define CORE_PRIVATE
 
 #include "mod_proxy.h"
+#include "scoreboard.h"
 #include "ap_mpm.h"
 #include "apr_version.h"
 #include "apr_hooks.h"
@@ -86,22 +87,37 @@ static int init_balancer_members(proxy_server_conf *conf, server_rec *s,
 {
     int i;
     proxy_worker *workers;
+    int worker_is_initialized;
+    proxy_worker_stat *slot;
 
     workers = (proxy_worker *)balancer->workers->elts;
 
     for (i = 0; i < balancer->workers->nelts; i++) {
+        worker_is_initialized = PROXY_WORKER_IS_INITIALIZED(workers);
+        if (!worker_is_initialized) {
+            /*
+             * If the worker is not initialized check whether its scoreboard
+             * slot is already initialized.
+             */
+            slot = (proxy_worker_stat *) ap_get_scoreboard_lb(workers->id);
+            if (slot) {
+                worker_is_initialized = slot->status & PROXY_WORKER_INITIALIZED;
+            }
+            else {
+                worker_is_initialized = 0;
+            }
+        }
         ap_proxy_initialize_worker_share(conf, workers, s);
         ap_proxy_initialize_worker(workers, s);
+        if (!worker_is_initialized) {
+            /* Set to the original configuration */
+            workers->s->lbstatus = workers->s->lbfactor =
+            (workers->lbfactor ? workers->lbfactor : 1);
+            workers->s->lbset = workers->lbset;
+        }
         ++workers;
     }
 
-    workers = (proxy_worker *)balancer->workers->elts;
-    for (i = 0; i < balancer->workers->nelts; i++) {
-        /* Set to the original configuration */
-        workers[i].s->lbstatus = workers[i].s->lbfactor =
-          (workers[i].lbfactor ? workers[i].lbfactor : 1);
-        workers[i].s->lbset = workers[i].lbset;
-    }
     /* Set default number of attempts to the number of
      * workers.
      */