From: Manoj Kasichainula Date: Wed, 13 Oct 1999 20:14:53 +0000 (+0000) Subject: Add a config directive to Dexter to not maintain any connection status, X-Git-Tag: 1.3.10~266 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a0d39f41d84272ad85f1f6728e2014e0b84ee5c;p=apache Add a config directive to Dexter to not maintain any connection status, 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 --- diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index 6fe483bde7..5cb09d9dcf 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -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 } diff --git a/server/mpm/dexter/scoreboard.c b/server/mpm/dexter/scoreboard.c index fcb204946d..1c1c87f12e 100644 --- a/server/mpm/dexter/scoreboard.c +++ b/server/mpm/dexter/scoreboard.c @@ -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; diff --git a/server/mpm/dexter/scoreboard.h b/server/mpm/dexter/scoreboard.h index 300adda893..b5dd259026 100644 --- a/server/mpm/dexter/scoreboard.h +++ b/server/mpm/dexter/scoreboard.h @@ -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 {