Commit 3c80cd97 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

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
parent 1446fab9
Loading
Loading
Loading
Loading
+1 −0
Changes for modules/proxy/mod_proxy.h: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -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)))
+8 −2
Changes for modules/proxy/mod_proxy_balancer.c: 8 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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;
                }
            }
        }
+5 −0
Changes for modules/proxy/proxy_util.c: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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;
}