On Sun, 13 Feb 2011, Ruediger Pluem wrote:
On 02/12/2011 10:23 PM, [email protected] wrote:
Author: sf
Date: Sat Feb 12 21:23:56 2011
New Revision: 1070153

URL: http://svn.apache.org/viewvc?rev=1070153&view=rev
Log:
Use ap_state_query() to fix many modules that were not correctly initializing
if they were not active during server startup but got enabled later during a
graceful restart (in which case they need to do all work during a single
config run).

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/aaa/mod_auth_digest.c
    httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
    httpd/httpd/trunk/modules/core/mod_watchdog.c
    httpd/httpd/trunk/modules/examples/mod_example_ipc.c
    httpd/httpd/trunk/modules/generators/mod_cgid.c
    httpd/httpd/trunk/modules/ldap/util_ldap.c
    httpd/httpd/trunk/modules/mappers/mod_rewrite.c
    httpd/httpd/trunk/modules/proxy/balancers/mod_lbmethod_heartbeat.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
    httpd/httpd/trunk/modules/session/mod_session_crypto.c
    httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
    httpd/httpd/trunk/modules/ssl/ssl_scache.c


Modified: httpd/httpd/trunk/modules/core/mod_watchdog.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/core/mod_watchdog.c?rev=1070153&r1=1070152&r2=1070153&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/core/mod_watchdog.c (original)
+++ httpd/httpd/trunk/modules/core/mod_watchdog.c Sat Feb 12 21:23:56 2011

@@ -444,11 +445,12 @@ static int wd_post_config_hook(apr_pool_
         if (!(wd_server_conf = apr_pcalloc(pproc, sizeof(wd_server_conf_t))))
             return APR_ENOMEM;
         apr_pool_create(&wd_server_conf->pool, pproc);
-        wd_server_conf->s = s;
-        apr_pool_userdata_set(wd_server_conf, pk, apr_pool_cleanup_null, 
pproc);
+    }
+
+    if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG)
         /* First time config phase -- skip. */
         return OK;
-    }
+

Can't this be regrouped such that we do not do the pr_pcalloc(pproc, 
sizeof(wd_server_conf_t)))) when we are in
AP_SQ_MS_CREATE_PRE_CONFIG state?

It can. And the apr_pool_userdata_set call should not have been removed.



 #if defined(WIN32)
     {
         const char *ppid = getenv("AP_PARENT_PID");


Modified: httpd/httpd/trunk/modules/ssl/ssl_scache.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/ssl_scache.c?rev=1070153&r1=1070152&r2=1070153&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_scache.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_scache.c Sat Feb 12 21:23:56 2011
@@ -50,12 +48,8 @@ void ssl_scache_init(server_rec *s, apr_
      * this first (and only the first) time through, since the pool
      * will be immediately cleared anyway.  For every subsequent
      * invocation, initialize the configured cache. */
-    apr_pool_userdata_get(&data, userdata_key, s->process->pool);
-    if (!data) {
-        apr_pool_userdata_set((const void *)1, userdata_key,
-                              apr_pool_cleanup_null, s->process->pool);
+    if (!ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG)

I think this should be ap_state_query(AP_SQ_MAIN_STATE) == 
AP_SQ_MS_CREATE_PRE_CONFIG and
not !ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG.

True. Thanks for the review. Both are fixed in r1070317

Cheers,
Stefan

Reply via email to