From: Jim Jagielski Date: Thu, 31 Mar 2011 17:00:36 +0000 (+0000) Subject: If we change the LB method, or we take add in a new X-Git-Tag: 2.3.12~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c1603996ec69e9f307107364e05e9d62bc47407;p=thirdparty%2Fapache%2Fhttpd.git If we change the LB method, or we take add in a new balancermember ("enable" her), then we need to have the LBmethod reset its params as required... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1087371 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 2a9309cf762..2fd1952f0c8 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -402,6 +402,7 @@ typedef struct { unsigned int scolonsep:1; /* true if ';' seps sticky session paths */ unsigned int max_attempts_set:1; unsigned int was_malloced:1; + unsigned int need_reset:1; } proxy_balancer_shared; #define ALIGNED_PROXY_BALANCER_SHARED_SIZE (APR_ALIGN_DEFAULT(sizeof(proxy_balancer_shared))) diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index 24febdd57f0..f359f9fea97 100644 --- a/modules/proxy/mod_proxy_balancer.c +++ b/modules/proxy/mod_proxy_balancer.c @@ -1007,6 +1007,10 @@ static int balancer_handler(request_rec *r) } if ((val = apr_table_get(params, "w_status_D"))) { ap_proxy_set_wstatus('D', atoi(val), wsel); + /* if enabling, we need to reset all lb params */ + if (bsel && !(atoi(val))) { + bsel->s->need_reset = 1; + } } if ((val = apr_table_get(params, "w_status_H"))) { ap_proxy_set_wstatus('H', atoi(val), wsel); @@ -1025,13 +1029,15 @@ static int balancer_handler(request_rec *r) int ival; ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "settings balancer params"); if ((val = apr_table_get(params, "b_lbm"))) { - if (strlen(val) < (sizeof(bsel->s->lbpname)-1)) { + if ((strlen(val) < (sizeof(bsel->s->lbpname)-1)) && + strcmp(val, bsel->s->lbpname)) { proxy_balancer_method *lbmethod; - lbmethod = ap_lookup_provider(PROXY_LBMETHOD, bsel->s->lbpname, "0"); + lbmethod = ap_lookup_provider(PROXY_LBMETHOD, val, "0"); if (lbmethod) { PROXY_STRNCPY(bsel->s->lbpname, val); bsel->lbmethod = lbmethod; bsel->s->wupdated = apr_time_now(); + bsel->s->need_reset = 1; } } } diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index c68572ae677..8339d40376a 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -3002,6 +3002,11 @@ PROXY_DECLARE(apr_status_t) ap_proxy_sync_balancer(proxy_balancer *b, server_rec } } } + if (b->s->need_reset) { + if (b->lbmethod && b->lbmethod->reset) + b->lbmethod->reset(b, s); + b->s->need_reset = 0; + } b->wupdated = b->s->wupdated; return APR_SUCCESS; }