You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2010/04/22 16:52:44 UTC

svn commit: r936880 - /httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c

Author: jim
Date: Thu Apr 22 14:52:43 2010
New Revision: 936880

URL: http://svn.apache.org/viewvc?rev=936880&view=rev
Log:
Move back to a post_config hook... 

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c?rev=936880&r1=936879&r2=936880&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c Thu Apr 22 14:52:43 2010
@@ -662,17 +662,25 @@ static void recalc_factors(proxy_balance
     }
 }
 
-/* pre_config hook: */
-static int balancer_init(apr_pool_t *pconf, apr_pool_t *plog,
-                         apr_pool_t *ptemp)
+/* post_config hook: */
+static int balancer_init(apr_pool_t *p, apr_pool_t *plog,
+                         apr_pool_t *ptemp, server_rec *s)
 {
     apr_uuid_t uuid;
+    void *data;
+    const char *userdata_key = "mod_proxy_balancer_init";
 
-    /* Retrieve a UUID and store the nonce for the lifetime of
-     * the process. */
-    apr_uuid_get(&uuid);
-    apr_uuid_format(balancer_nonce, &uuid);
-
+    /* balancer_init() will be called twice during startup.  So, only
+     * set up the static data the 1st time through. */
+    apr_pool_userdata_get(&data, userdata_key, s->process->pool);
+    if (!data) {
+        /* Retrieve a UUID and store the nonce for the lifetime of
+         * the process. */
+        apr_uuid_get(&uuid);
+        apr_uuid_format(balancer_nonce, &uuid);
+        apr_pool_userdata_set((const void *)1, userdata_key,
+                               apr_pool_cleanup_null, s->process->pool);
+    }
     return OK;
 }
 
@@ -1002,7 +1010,7 @@ static void ap_proxy_balancer_register_h
      */
     static const char *const aszPred[] = { "mpm_winnt.c", NULL};
      /* manager handler */
-    ap_hook_pre_config(balancer_init, NULL, NULL, APR_HOOK_MIDDLE);
+    ap_hook_post_config(balancer_init, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_handler(balancer_handler, NULL, NULL, APR_HOOK_FIRST);
     ap_hook_child_init(child_init, aszPred, NULL, APR_HOOK_MIDDLE);
     proxy_hook_pre_request(proxy_balancer_pre_request, NULL, NULL, APR_HOOK_FIRST);