]> granicus.if.org Git - apache/blobdiff - server/scoreboard.c
r1599852 and r1599799 in trunk
[apache] / server / scoreboard.c
index 72aa07045054db9b7a8d133d19df7982e0e009dd..24e9bc61faae9f642d2ae857041921f1adee580b 100644 (file)
@@ -42,6 +42,7 @@
 
 AP_DECLARE_DATA scoreboard *ap_scoreboard_image = NULL;
 AP_DECLARE_DATA const char *ap_scoreboard_fname = NULL;
+static ap_scoreboard_e scoreboard_type;
 
 const char * ap_set_scoreboard(cmd_parms *cmd, void *dummy,
                                const char *arg)
@@ -142,7 +143,7 @@ AP_DECLARE(int) ap_calc_scoreboard_size(void)
     return scoreboard_size;
 }
 
-void ap_init_scoreboard(void *shared_score)
+AP_DECLARE(void) ap_init_scoreboard(void *shared_score)
 {
     char *more_storage;
     int i;
@@ -250,7 +251,8 @@ static apr_status_t open_scoreboard(apr_pool_t *pconf)
 /* If detach is non-zero, this is a separate child process,
  * if zero, it is a forked child.
  */
-apr_status_t ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, int detached)
+AP_DECLARE(apr_status_t) ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm,
+                                              int detached)
 {
 #if APR_HAS_SHARED_MEMORY
     if (!detached) {
@@ -276,7 +278,7 @@ apr_status_t ap_cleanup_scoreboard(void *d)
     if (ap_scoreboard_image == NULL) {
         return APR_SUCCESS;
     }
-    if (ap_scoreboard_image->global->sb_type == SB_SHARED) {
+    if (scoreboard_type == SB_SHARED) {
         ap_cleanup_shared_mem(NULL);
     }
     else {
@@ -329,7 +331,7 @@ int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
         ap_init_scoreboard(sb_mem);
     }
 
-    ap_scoreboard_image->global->sb_type = sb_type;
+    scoreboard_type = sb_type;
     ap_scoreboard_image->global->running_generation = 0;
     ap_scoreboard_image->global->restart_time = apr_time_now();
 
@@ -387,7 +389,7 @@ AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sb, request_rec *r)
 AP_DECLARE(int) ap_find_child_by_pid(apr_proc_t *pid)
 {
     int i;
-    int max_daemons_limit;
+    int max_daemons_limit = 0;
 
     ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_daemons_limit);
 
@@ -486,8 +488,9 @@ static int update_child_status_internal(int child_num,
                         REMOTE_NOLOOKUP, NULL), sizeof(ws->client));
             copy_request(ws->request, sizeof(ws->request), r);
             if (r->server) {
-                apr_cpystrn(ws->vhost, r->server->server_hostname,
-                            sizeof(ws->vhost));
+                apr_snprintf(ws->vhost, sizeof(ws->vhost), "%s:%d",
+                             r->server->server_hostname,
+                             r->connection->local_addr->port);
             }
         }
         else if (c) {