]> granicus.if.org Git - apache/commitdiff
Add a config directive to Dexter to not maintain any connection status,
authorManoj Kasichainula <manoj@apache.org>
Wed, 13 Oct 1999 20:14:53 +0000 (20:14 +0000)
committerManoj Kasichainula <manoj@apache.org>
Wed, 13 Oct 1999 20:14:53 +0000 (20:14 +0000)
similarly to what ExtendedStatus did in 1.3.  It's not perfect, since
the server might still go through effort to derive status info only to
have it not recorded, but it does go most of the way.

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

server/mpm/dexter/dexter.c
server/mpm/dexter/scoreboard.c
server/mpm/dexter/scoreboard.h

index 6fe483bde7035872d6fd4db86f362f61a81d615f..5cb09d9dcf9980dfc8f2379b4a85cd906b4f862f 100644 (file)
@@ -1214,7 +1214,7 @@ static void server_main_loop(int remaining_children_to_start)
 
                     child_slot = i;
                     for (j = 0; j < HARD_THREAD_LIMIT; j++) {
-                        ap_reset_connection_status(i * HARD_THREAD_LIMIT + j);
+                        ap_dexter_force_reset_connection_status(i * HARD_THREAD_LIMIT + j);
                     }
                     break;
                 }
@@ -1448,6 +1448,7 @@ static void dexter_pre_config(ap_context_t *p, ap_context_t *plog, ap_context_t
     ap_pid_fname = DEFAULT_PIDLOG;
     ap_lock_fname = DEFAULT_LOCKFILE;
     max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
+    ap_dexter_set_maintain_connection_status(1);
 
     ap_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
 }
@@ -1591,6 +1592,18 @@ static const char *set_max_requests(cmd_parms *cmd, void *dummy, char *arg)
     return NULL;
 }
 
+static const char *set_maintain_connection_status(cmd_parms *cmd,
+                                                  core_dir_config *d, int arg) 
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    ap_dexter_set_maintain_connection_status(arg != 0);
+    return NULL;
+}
+
 static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) 
 {
     struct stat finfo;
@@ -1662,6 +1675,8 @@ LISTEN_COMMANDS
   "Maximum number of threads per child" },
 { "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, TAKE1,
   "Maximum number of requests a particular child serves before dying." },
+{ "ConnectionStatus", set_maintain_connection_status, NULL, RSRC_CONF, FLAG,
+  "Whether or not to maintain status information on current connections"},
 { "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, TAKE1,
   "The location of the directory Apache changes to before dumping core" },
 { NULL }
index fcb204946daa09382fe9b28fca3c8f189a2aba6e..1c1c87f12ec493d8e55a4acf55ecd50c42199f91 100644 (file)
@@ -439,7 +439,16 @@ void reinit_scoreboard(ap_context_t *p)
  * Above code is shmem code. Below code is interacting with the shmem
  ****/
 
-void ap_reset_connection_status(long conn_id)
+static int maintain_connection_status = 1;
+
+void ap_dexter_set_maintain_connection_status(int flag) {
+    maintain_connection_status = flag;
+    return;
+}
+
+/* Useful to erase the status of children that might be from previous
+ * generations */
+void ap_dexter_force_reset_connection_status(long conn_id)
 {
     int i;
 
@@ -448,12 +457,20 @@ void ap_reset_connection_status(long conn_id)
     }
 }
 
+void ap_reset_connection_status(long conn_id)
+{
+    if (maintain_connection_status) {
+        ap_dexter_force_reset_connection_status(conn_id);
+    }
+}
+
 /* Don't mess with the string you get back from this function */
 const char *ap_get_connection_status(long conn_id, const char *key)
 {
     int i = 0;
     status_table_entry *ss;
 
+    if (!maintain_connection_status) return "";
     while (i < STATUSES_PER_CONNECTION) {
         ss = &(ap_scoreboard_image->table[conn_id][i]);
         if (ss->key[0] == '\0') {
@@ -477,6 +494,7 @@ void ap_update_connection_status(long conn_id, const char *key,
     int i = 0;
     status_table_entry *ss;
 
+    if (!maintain_connection_status) return;
     while (i < STATUSES_PER_CONNECTION) {
         ss = &(ap_scoreboard_image->table[conn_id][i]);
         if (ss->key[0] == '\0') {
@@ -506,6 +524,11 @@ ap_array_header_t *ap_get_status_table(ap_context_t *p)
     status_table_entry *ss;
 
     server_status = ap_make_array(p, 0, sizeof(ap_status_table_row_t));
+
+    /* Go ahead and return what's in the connection status table even if we
+     * aren't maintaining it. We can at least look at what children from
+     * previous generations are up to. */
+
     for (i = 0; i < max_daemons_limit*HARD_THREAD_LIMIT; i++) {
        if (ap_scoreboard_image->table[i][0].key[0] == '\0')
            continue;
index 300adda893fa76aec4d5e89babfeea5beb5dac44..b5dd25902632539ce74c259cce6531b311f3352b 100644 (file)
@@ -82,6 +82,9 @@ API_EXPORT(void) reopen_scoreboard(ap_context_t *p);
 /* The stuff for Dexter's status table */
 
 #include "mpm_status.h"
+
+void ap_dexter_set_maintain_connection_status(int flag);
+void ap_dexter_force_reset_connection_status(long conn_id);
 #define KEY_LENGTH 16
 #define VALUE_LENGTH 64
 typedef struct {