From: Jim Jagielski Date: Thu, 22 Apr 2010 14:52:43 +0000 (+0000) Subject: Move back to a post_config hook... X-Git-Tag: 2.3.6~166 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=84f90804458c8476642e53049e5bf3fcc61260c1;p=thirdparty%2Fapache%2Fhttpd.git Move back to a post_config hook... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@936880 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index 317b25b5f35..f35b3b34813 100644 --- a/modules/proxy/mod_proxy_balancer.c +++ b/modules/proxy/mod_proxy_balancer.c @@ -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);