]> granicus.if.org Git - apache/commitdiff
Set default number of maxattempts to the number of
authorMladen Turk <mturk@apache.org>
Mon, 11 Apr 2005 08:42:33 +0000 (08:42 +0000)
committerMladen Turk <mturk@apache.org>
Mon, 11 Apr 2005 08:42:33 +0000 (08:42 +0000)
balancer members.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@160847 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_balancer.c

index fd778bca2d4f309825d45668ea6715e8da537239..ab122892f7373421cb6dc6c1a5a214e43b495078 100644 (file)
@@ -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 */