From: hno <> Date: Wed, 22 Nov 2006 06:37:50 +0000 (+0000) Subject: Add support for the weight= parameter to round-robin peers X-Git-Tag: SQUID_3_0_PRE6~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=561209647d6bd2feb6b5da97a944d4b73e378ea6;p=thirdparty%2Fsquid.git Add support for the weight= parameter to round-robin peers --- diff --git a/src/neighbors.cc b/src/neighbors.cc index 77069f916f..190ae291fc 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -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; }