}
}
-/* 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;
}
*/
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);