httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r179617 - /httpd/httpd/trunk/server/config.c
Date Thu, 02 Jun 2005 17:49:47 GMT
Author: pquerna
Date: Thu Jun  2 10:49:46 2005
New Revision: 179617

URL: http://svn.apache.org/viewcvs?rev=179617&view=rev
Log:
- Fix graceful restarts with the new hashed configuration.  The hash now allocates out of
the pconf pool, instead of the process pool.

Modified:
    httpd/httpd/trunk/server/config.c

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/config.c?rev=179617&r1=179616&r2=179617&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Thu Jun  2 10:49:46 2005
@@ -410,6 +410,7 @@
     }
 }
 
+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 @@
     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 @@
 
     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 @@
     }
 #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 @@
 
     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
@@ -1456,6 +1482,10 @@
 
     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;



Mime
View raw message