From 561209647d6bd2feb6b5da97a944d4b73e378ea6 Mon Sep 17 00:00:00 2001 From: hno <> Date: Wed, 22 Nov 2006 06:37:50 +0000 Subject: [PATCH] Add support for the weight= parameter to round-robin peers --- src/neighbors.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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; } -- 2.47.3