]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
date: 2002/10/24 18:49:56; author: wessels; state: Exp; lines: +20 -4
authorhno <>
Sat, 9 Nov 2002 16:34:22 +0000 (16:34 +0000)
committerhno <>
Sat, 9 Nov 2002 16:34:22 +0000 (16:34 +0000)
Bugzilla #462: WCCP doesn't ensure WCCP_ASSIGN_BUCKETS message was received

This patch makes Squid remember the change value when it last sent a
WCCP_ASSIGN_BUCKETS message.  It will resend the message until
the router updates the change value.

src/wccp.cc

index 85a597df12aa6700b1cf93add7f850a854a67811..53285631f035fb89197890bb5036d8aa3e4841a9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wccp.cc,v 1.29 2002/10/21 16:12:47 hno Exp $
+ * $Id: wccp.cc,v 1.30 2002/11/09 09:34:22 hno Exp $
  *
  * DEBUG: section 80    WCCP Support
  * AUTHOR: Glenn Chisholm
@@ -85,6 +85,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 last_assign_buckets_change;
 static int number_caches;
 static struct in_addr local_ip;
 
@@ -110,6 +111,7 @@ wccpInit(void)
     wccp_here_i_am.version = htonl(Config.Wccp.version);
     wccp_here_i_am.revision = htonl(WCCP_REVISION);
     change = 0;
+    last_assign_buckets_change = 0;
     if (Config.Wccp.router.s_addr != any_addr.s_addr)
        if (!eventFind(wccpHereIam, NULL))
            eventAdd("wccpHereIam", wccpHereIam, NULL, 5.0, 1);
@@ -242,14 +244,28 @@ wccpHandleUdp(int sock, void *not_used)
        return;
     if (ntohl(wccp_i_see_you.type) != WCCP_I_SEE_YOU)
        return;
-    if ((!change) && (number_caches == ntohl(wccp_i_see_you.number))) {
-       change = wccp_i_see_you.change;
-       return;
+    if ((0 == change) && (number_caches == ntohl(wccp_i_see_you.number))) {
+       if (last_assign_buckets_change == wccp_i_see_you.change) {
+           /*
+            * After a WCCP_ASSIGN_BUCKET message, the router should
+            * update the change value.  If not, maybe the route didn't
+            * receive our WCCP_ASSIGN_BUCKET message, so send it again.
+            *
+            * Don't update change here.  Instead, fall through to
+            * the next block to call wccpAssignBuckets() again.
+            */
+           (void) 0;
+       } else {
+           change = wccp_i_see_you.change;
+           return;
+       }
     }
     if (change != wccp_i_see_you.change) {
        change = wccp_i_see_you.change;
-       if (wccpLowestIP() && wccp_i_see_you.number)
+       if (wccpLowestIP() && wccp_i_see_you.number) {
+           last_assign_buckets_change = change;
            wccpAssignBuckets();
+       }
     }
 }