summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Querna <pquerna@apache.org>2005-06-02 17:49:46 +0000
committerPaul Querna <pquerna@apache.org>2005-06-02 17:49:46 +0000
commitd4dfb2fc442b45c9a388de7ed90cb5d59495ad40 (patch)
tree3cbe8d66c8a9d1916041bc536c17438b1f3fa9e0
parenta91f8025a8226ba0a8492e43415fdec7f66ec8ff (diff)
downloadhttpd-d4dfb2fc442b45c9a388de7ed90cb5d59495ad40.tar.gz
- Fix graceful restarts with the new hashed configuration. The hash now allocates out of the pconf pool, instead of the process pool.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@179617 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--server/config.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/server/config.c b/server/config.c
index 808724f701..de966526e4 100644
--- a/server/config.c
+++ b/server/config.c
@@ -410,6 +410,7 @@ AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p)
}
}
+static void ap_add_module_commands(module *m, apr_pool_t *p);
typedef struct ap_mod_list_struct ap_mod_list;
struct ap_mod_list_struct {
@@ -418,7 +419,28 @@ struct ap_mod_list_struct {
const command_rec *cmd;
};
-static void ap_add_module_commands(module *m)
+static apr_status_t reload_conf_hash(void* baton)
+{
+ ap_config_hash = NULL;
+ return APR_SUCCESS;
+}
+
+static void rebuild_conf_hash(apr_pool_t *p, int add_prelinked)
+{
+ module **m;
+
+ ap_config_hash = apr_hash_make(p);
+
+ apr_pool_cleanup_register(p, NULL, reload_conf_hash,
+ apr_pool_cleanup_null);
+ if (add_prelinked) {
+ for (m = ap_prelinked_modules; *m != NULL; m++) {
+ ap_add_module_commands(*m, p);
+ }
+ }
+}
+
+static void ap_add_module_commands(module *m, apr_pool_t *p)
{
apr_pool_t* tpool;
ap_mod_list* mln;
@@ -427,6 +449,10 @@ static void ap_add_module_commands(module *m)
cmd = m->cmds;
+ if (ap_config_hash == NULL) {
+ rebuild_conf_hash(p, 0);
+ }
+
tpool = apr_hash_pool_get(ap_config_hash);
while (cmd && cmd->name) {
@@ -501,7 +527,7 @@ AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p)
}
#endif /*_OSD_POSIX*/
- ap_add_module_commands(m);
+ ap_add_module_commands(m, p);
/* FIXME: is this the right place to call this?
* It doesn't appear to be
*/
@@ -622,7 +648,7 @@ AP_DECLARE(const char *) ap_setup_prelinked_modules(process_rec *process)
apr_hook_global_pool=process->pconf;
- ap_config_hash = apr_hash_make(process->pool);
+ rebuild_conf_hash(process->pconf, 0);
/*
* Initialise total_modules variable and module indices
@@ -1457,6 +1483,10 @@ static const char *process_command_config(server_rec *s,
arr_parms.curr_idx = 0;
arr_parms.array = arr;
+ if (ap_config_hash == NULL) {
+ rebuild_conf_hash(s->process->pconf, 1);
+ }
+
parms = default_parms;
parms.pool = p;
parms.temp_pool = ptemp;