From: Jim Jagielski Date: Wed, 30 Sep 2009 18:58:34 +0000 (+0000) Subject: Try to have consistent interface regardless of slotmem or X-Git-Tag: 2.3.3~241 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2810699d0c9a9913e2ed548dc778e4b4be982f5b;p=apache Try to have consistent interface regardless of slotmem or file-based. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@820388 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/balancers/mod_lbmethod_heartbeat.c b/modules/proxy/balancers/mod_lbmethod_heartbeat.c index d5300c33bb..0ab9a07ccd 100644 --- a/modules/proxy/balancers/mod_lbmethod_heartbeat.c +++ b/modules/proxy/balancers/mod_lbmethod_heartbeat.c @@ -232,6 +232,18 @@ static apr_status_t readslot_heartbeats(apr_hash_t *servers, return APR_SUCCESS; } + +static apr_status_t read_heartbeats(const char *path, apr_hash_t *servers, + apr_pool_t *pool) +{ + apr_status_t rv; + if (hm_serversmem) + rv = readslot_heartbeats(servers, pool); + else + rv = readfile_heartbeats(path, servers, pool); + return rv; +} + /* * Finding a random number in a range. * n' = a + n(b-a+1)/(M+1) @@ -283,10 +295,7 @@ static proxy_worker *find_best_hb(proxy_balancer *balancer, servers = apr_hash_make(tpool); - if (hm_serversmem) - rv = readslot_heartbeats(servers, tpool); - else - rv = readfile_heartbeats(ctx->path, servers, tpool); + rv = read_heartbeats(ctx->path, servers, tpool); if (rv) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, @@ -371,7 +380,9 @@ static int lb_hb_init(apr_pool_t *p, apr_pool_t *plog, void *data; apr_size_t size; unsigned int num; - + lb_hb_ctx_t *ctx = ap_get_module_config(s->module_config, + &lbmethod_heartbeat_module); + apr_pool_userdata_get(&data, userdata_key, s->process->pool); if (!data) { /* first call do nothing */ @@ -391,6 +402,9 @@ static int lb_hb_init(apr_pool_t *p, apr_pool_t *plog, } else ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, s, "Using slotmem from mod_heartmonitor"); + if (hm_serversmem) + ctx->path = "(slotmem)"; + return OK; }