]> granicus.if.org Git - apache/commitdiff
The source of some ills ... there is no reason to keep going if the
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 20 Mar 2002 06:04:51 +0000 (06:04 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 20 Mar 2002 06:04:51 +0000 (06:04 +0000)
  scoreboard exists.  I suspect this should be a general cleanup as well
  [at the end of ap_create_scoreboard.]  But calling ap_run_pre_mpm with
  the process->pool should take care of a clobbered scoreboard shm on
  graceful restart.

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

server/scoreboard.c

index b1f5b69264002870fdd310ad180ceb2f4ce3313a..8e866f6975c6339b47a4a75d91dc38f54015f81d 100644 (file)
@@ -295,38 +295,40 @@ int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
 
     if (ap_scoreboard_image) {
         running_gen = ap_scoreboard_image->global->running_generation;
+        return OK;
     }
 
-    if (ap_scoreboard_image == NULL) {
-        ap_calc_scoreboard_size();
+    ap_calc_scoreboard_size();
 #if APR_HAS_SHARED_MEMORY
-        if (sb_type == SB_SHARED) {
-            void *sb_shared;
-            rv = open_scoreboard(p);
-            if (rv || !(sb_shared = apr_shm_baseaddr_get(ap_scoreboard_shm))) {
-                return HTTP_INTERNAL_SERVER_ERROR;
-            }
-            memset(sb_shared, 0, scoreboard_size);
-            ap_init_scoreboard(sb_shared);
+    if (sb_type == SB_SHARED) {
+        void *sb_shared;
+        rv = open_scoreboard(p);
+        if (rv || !(sb_shared = apr_shm_baseaddr_get(ap_scoreboard_shm))) {
+            return HTTP_INTERNAL_SERVER_ERROR;
         }
-        else 
+        memset(sb_shared, 0, scoreboard_size);
+        ap_init_scoreboard(sb_shared);
+    }
+    else 
 #endif
-        {
-            /* A simple malloc will suffice */
-            void *sb_mem = calloc(1, scoreboard_size);
-            if (sb_mem == NULL) {
-                ap_log_error(APLOG_MARK, APLOG_CRIT | APLOG_NOERRNO, 0, NULL,
-                             "(%d)%s: cannot allocate scoreboard",
-                             errno, strerror(errno));
-                return HTTP_INTERNAL_SERVER_ERROR;
-            }
-            ap_init_scoreboard(sb_mem);
+    {
+        /* A simple malloc will suffice */
+        void *sb_mem = calloc(1, scoreboard_size);
+        if (sb_mem == NULL) {
+            ap_log_error(APLOG_MARK, APLOG_CRIT | APLOG_NOERRNO, 0, NULL,
+                         "(%d)%s: cannot allocate scoreboard",
+                         errno, strerror(errno));
+            return HTTP_INTERNAL_SERVER_ERROR;
         }
+        ap_init_scoreboard(sb_mem);
     }
+
     ap_scoreboard_image->global->sb_type = sb_type;
     ap_scoreboard_image->global->running_generation = running_gen;
     ap_scoreboard_image->global->restart_time = apr_time_now();
+
     apr_pool_cleanup_register(p, NULL, ap_cleanup_scoreboard, apr_pool_cleanup_null);
+
     return OK;
 }