]> granicus.if.org Git - apache/commitdiff
Don't set worker->s if already set (for balancer using slotmem for examples).
authorJean-Frederic Clere <jfclere@apache.org>
Fri, 26 Jun 2009 14:26:19 +0000 (14:26 +0000)
committerJean-Frederic Clere <jfclere@apache.org>
Fri, 26 Jun 2009 14:26:19 +0000 (14:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@788718 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_util.c

index 81eb944ab5690dccc071cc04ea0f3d9a05018d99..64e0cfd7ea66f1c9467c8090843a4aa52a9bb767 100644 (file)
@@ -1785,38 +1785,40 @@ PROXY_DECLARE(void) ap_proxy_initialize_worker_share(proxy_server_conf *conf,
               worker->name);
         return;
     }
-    /* Get scoreboard slot */
-    if (ap_scoreboard_image) {
-        score = (proxy_worker_stat *) ap_get_scoreboard_lb(worker->id);
+    if (!worker->s) {
+        /* Get scoreboard slot */
+        if (ap_scoreboard_image) {
+            score = (proxy_worker_stat *) ap_get_scoreboard_lb(worker->id);
+            if (!score) {
+                ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
+                      "proxy: ap_get_scoreboard_lb(%d) failed in child %" APR_PID_T_FMT " for worker %s",
+                      worker->id, getpid(), worker->name);
+            }
+            else {
+                 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+                      "proxy: grabbed scoreboard slot %d in child %" APR_PID_T_FMT " for worker %s",
+                      worker->id, getpid(), worker->name);
+            }
+        }
         if (!score) {
-            ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
-                  "proxy: ap_get_scoreboard_lb(%d) failed in child %" APR_PID_T_FMT " for worker %s",
-                  worker->id, getpid(), worker->name);
+            score = (proxy_worker_stat *) apr_pcalloc(conf->pool, sizeof(proxy_worker_stat));
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+                  "proxy: initialized plain memory in child %" APR_PID_T_FMT " for worker %s",
+                  getpid(), worker->name);
         }
-        else {
-             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
-                  "proxy: grabbed scoreboard slot %d in child %" APR_PID_T_FMT " for worker %s",
-                  worker->id, getpid(), worker->name);
+        worker->s = score;
+        /*
+         * recheck to see if we've already been here. Possible
+         * if proxy is using scoreboard to hold shared stats
+         */
+        if (PROXY_WORKER_IS_INITIALIZED(worker)) {
+            /* The worker share is already initialized */
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
+                  "proxy: worker %s already initialized",
+                  worker->name);
+            return;
         }
     }
-    if (!score) {
-        score = (proxy_worker_stat *) apr_pcalloc(conf->pool, sizeof(proxy_worker_stat));
-        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
-              "proxy: initialized plain memory in child %" APR_PID_T_FMT " for worker %s",
-              getpid(), worker->name);
-    }
-    worker->s = score;
-    /*
-     * recheck to see if we've already been here. Possible
-     * if proxy is using scoreboard to hold shared stats
-     */
-    if (PROXY_WORKER_IS_INITIALIZED(worker)) {
-        /* The worker share is already initialized */
-        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
-              "proxy: worker %s already initialized",
-              worker->name);
-        return;
-    }
     if (worker->route) {
         strcpy(worker->s->route, worker->route);
     }