httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1087371 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_balancer.c proxy_util.c
Date Thu, 31 Mar 2011 17:00:36 GMT
Author: jim
Date: Thu Mar 31 17:00:36 2011
New Revision: 1087371

URL: http://svn.apache.org/viewvc?rev=1087371&view=rev
Log:
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...

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy.h
    httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=1087371&r1=1087370&r2=1087371&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Thu Mar 31 17:00:36 2011
@@ -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)))

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c?rev=1087371&r1=1087370&r2=1087371&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_balancer.c Thu Mar 31 17:00:36 2011
@@ -1007,6 +1007,10 @@ static int balancer_handler(request_rec 
         }
         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 
         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;
                 }
             }
         }

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1087371&r1=1087370&r2=1087371&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Thu Mar 31 17:00:36 2011
@@ -3002,6 +3002,11 @@ PROXY_DECLARE(apr_status_t) ap_proxy_syn
             }
         }
     }
+    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;
 }



Mime
View raw message