]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add support for the weight= parameter to round-robin peers
authorhno <>
Wed, 22 Nov 2006 06:37:50 +0000 (06:37 +0000)
committerhno <>
Wed, 22 Nov 2006 06:37:50 +0000 (06:37 +0000)
src/neighbors.cc

index 77069f916fcdfb4e67c7940c6314a3e15c0ee322..190ae291fc94d0fcb8eb8dd71a0039fe3061d000 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.340 2006/08/21 00:50:41 robertc Exp $
+ * $Id: neighbors.cc,v 1.341 2006/11/21 23:37:50 hno Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -346,8 +346,12 @@ getRoundRobinParent(HttpRequest * request)
         if (!peerHTTPOkay(p, request))
             continue;
 
-        if (q && q->rr_count < p->rr_count)
-            continue;
+       if (p->weight == 1) {
+           if (q && q->rr_count < p->rr_count)
+               continue;
+       } else if (p->weight == 0 || q && q->rr_count < (p->rr_count / p->weight)) {
+           continue;
+       }
 
         q = p;
     }