From a94b2e9e90dd22eefb0f63827335df70325cc713 Mon Sep 17 00:00:00 2001 From: Jean-Frederic Clere Date: Fri, 26 Jun 2009 14:26:19 +0000 Subject: [PATCH] Don't set worker->s if already set (for balancer using slotmem for examples). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@788718 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/proxy_util.c | 58 ++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 81eb944ab5..64e0cfd7ea 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -1785,38 +1785,40 @@ PROXY_DECLARE(void) ap_proxy_initialize_worker_share(proxy_server_conf *conf, worker->name); return; } - /* Get scoreboard slot */ - if (ap_scoreboard_image) { - score = (proxy_worker_stat *) ap_get_scoreboard_lb(worker->id); + if (!worker->s) { + /* Get scoreboard slot */ + if (ap_scoreboard_image) { + score = (proxy_worker_stat *) ap_get_scoreboard_lb(worker->id); + if (!score) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "proxy: ap_get_scoreboard_lb(%d) failed in child %" APR_PID_T_FMT " for worker %s", + worker->id, getpid(), worker->name); + } + else { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "proxy: grabbed scoreboard slot %d in child %" APR_PID_T_FMT " for worker %s", + worker->id, getpid(), worker->name); + } + } if (!score) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, - "proxy: ap_get_scoreboard_lb(%d) failed in child %" APR_PID_T_FMT " for worker %s", - worker->id, getpid(), worker->name); + score = (proxy_worker_stat *) apr_pcalloc(conf->pool, sizeof(proxy_worker_stat)); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "proxy: initialized plain memory in child %" APR_PID_T_FMT " for worker %s", + getpid(), worker->name); } - else { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, - "proxy: grabbed scoreboard slot %d in child %" APR_PID_T_FMT " for worker %s", - worker->id, getpid(), worker->name); + worker->s = score; + /* + * recheck to see if we've already been here. Possible + * if proxy is using scoreboard to hold shared stats + */ + if (PROXY_WORKER_IS_INITIALIZED(worker)) { + /* The worker share is already initialized */ + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "proxy: worker %s already initialized", + worker->name); + return; } } - if (!score) { - score = (proxy_worker_stat *) apr_pcalloc(conf->pool, sizeof(proxy_worker_stat)); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, - "proxy: initialized plain memory in child %" APR_PID_T_FMT " for worker %s", - getpid(), worker->name); - } - worker->s = score; - /* - * recheck to see if we've already been here. Possible - * if proxy is using scoreboard to hold shared stats - */ - if (PROXY_WORKER_IS_INITIALIZED(worker)) { - /* The worker share is already initialized */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, - "proxy: worker %s already initialized", - worker->name); - return; - } if (worker->route) { strcpy(worker->s->route, worker->route); } -- 2.40.0