From: Mladen Turk Date: Mon, 11 Apr 2005 08:42:33 +0000 (+0000) Subject: Set default number of maxattempts to the number of X-Git-Tag: 2.1.5~195 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e32503984e48959c8eab023a90cd280a9ca17423;p=apache Set default number of maxattempts to the number of balancer members. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@160847 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index fd778bca2d..ab122892f7 100644 --- a/modules/proxy/mod_proxy_balancer.c +++ b/modules/proxy/mod_proxy_balancer.c @@ -93,6 +93,13 @@ static int init_balancer_members(proxy_server_conf *conf, server_rec *s, workers[i].s->lbstatus = workers[i].s->lbfactor = (workers[i].lbfactor ? workers[i].lbfactor : 1); } + /* Set default number of attempts to the number of + * workers. + */ + if (!balancer->max_attempts_set && balancer->workers->nelts > 1) { + balancer->max_attempts = balancer->workers->nelts - 1; + balancer->max_attempts_set = 1; + } return 0; } @@ -440,8 +447,11 @@ static int proxy_balancer_pre_request(proxy_worker **worker, *worker = NULL; /* Step 1: check if the url is for us * The url we can handle starts with 'balancer://' + * If balancer is already provided skip the search + * for balancer, because this is failover attempt. */ - if (!(*balancer = ap_proxy_get_balancer(r->pool, conf, *url))) + if (!*balancer && + !(*balancer = ap_proxy_get_balancer(r->pool, conf, *url))) return DECLINED; /* Step 2: find the session route */