]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix a WCCP issue where a squid would show as being useable
authoradrian <>
Mon, 26 Aug 2002 15:27:53 +0000 (15:27 +0000)
committeradrian <>
Mon, 26 Aug 2002 15:27:53 +0000 (15:27 +0000)
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 <steven.wilton@team.eftel.com>

src/wccp.cc

index 1aeb292264c4a4f859fccf6e998ef5a0df168c49..77fd611ce1bcc6ae0121f895c00a4e7230b4a600 100644 (file)
@@ -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;