]> granicus.if.org Git - apache/commitdiff
Move back to a post_config hook...
authorJim Jagielski <jim@apache.org>
Thu, 22 Apr 2010 14:52:43 +0000 (14:52 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 22 Apr 2010 14:52:43 +0000 (14:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@936880 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_balancer.c

index 317b25b5f35e3f8e915a19be7cafda1d82a07313..f35b3b34813f607ee3bfc28eb56ff75eade0c0b5 100644 (file)
@@ -662,17 +662,25 @@ static void recalc_factors(proxy_balancer *balancer)
     }
 }
 
-/* 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;
-
-    /* Retrieve a UUID and store the nonce for the lifetime of
-     * the process. */
-    apr_uuid_get(&uuid);
-    apr_uuid_format(balancer_nonce, &uuid);
-
+    void *data;
+    const char *userdata_key = "mod_proxy_balancer_init";
+
+    /* 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_hook(apr_pool_t *p)
      */
     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);