From: adrian <> Date: Mon, 26 Aug 2002 15:27:53 +0000 (+0000) Subject: Fix a WCCP issue where a squid would show as being useable X-Git-Tag: SQUID_3_0_PRE1~823 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=994f613f673ea92031f2cabaedddc7636b50e353;p=thirdparty%2Fsquid.git Fix a WCCP issue where a squid would show as being useable on a WCCP router, but not being allocated any part of the hash. This can be replicated with >1 squid in a wccp cluster, with a squid making the hash decisions. Submitted by: Steven Wilton --- diff --git a/src/wccp.cc b/src/wccp.cc index 1aeb292264..77fd611ce1 100644 --- a/src/wccp.cc +++ b/src/wccp.cc @@ -1,6 +1,6 @@ /* - * $Id: wccp.cc,v 1.23 2002/06/21 13:16:30 hno Exp $ + * $Id: wccp.cc,v 1.24 2002/08/26 09:27:53 adrian Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Glenn Chisholm @@ -84,6 +84,7 @@ static int theOutWccpConnection = -1; static struct wccp_here_i_am_t wccp_here_i_am; static struct wccp_i_see_you_t wccp_i_see_you; static int change; +static int number_caches; static struct in_addr local_ip; static PF wccpHandleUdp; @@ -242,7 +243,7 @@ wccpHandleUdp(int sock, void *not_used) return; if (ntohl(wccp_i_see_you.type) != WCCP_I_SEE_YOU) return; - if (!change) { + if ((!change) && (number_caches == ntohl(wccp_i_see_you.number)) ) { change = wccp_i_see_you.change; return; } @@ -287,7 +288,6 @@ wccpAssignBuckets(void) char *buckets; int buckets_per_cache; int loop; - int number_caches; int bucket = 0; int *caches; int cache_len; @@ -321,6 +321,9 @@ wccpAssignBuckets(void) buckets[bucket++] = loop; } } + while (bucket < WCCP_BUCKETS) { + buckets[bucket++] = number_caches - 1; + } wccp_assign_bucket->type = htonl(WCCP_ASSIGN_BUCKET); wccp_assign_bucket->id = wccp_i_see_you.id; wccp_assign_bucket->number = wccp_i_see_you.number;