From: hno <> Date: Sat, 9 Nov 2002 16:34:22 +0000 (+0000) Subject: date: 2002/10/24 18:49:56; author: wessels; state: Exp; lines: +20 -4 X-Git-Tag: SQUID_3_0_PRE1~545 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1addf64a9912fe4d048c3b9e8d997db706c4d71e;p=thirdparty%2Fsquid.git date: 2002/10/24 18:49:56; author: wessels; state: Exp; lines: +20 -4 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. --- diff --git a/src/wccp.cc b/src/wccp.cc index 85a597df12..53285631f0 100644 --- a/src/wccp.cc +++ b/src/wccp.cc @@ -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(); + } } }