On Thu, 27 Jul 2006, Adrian Chadd wrote:
> On Thu, Jul 27, 2006, Steven Wilton wrote: > > I'd like to propose the attached patches for squid. > > > > The first is a config option for wccp2 to make squid wait until all > > cache_dirs have finished rebuilding before squid will register itself with > > WCCP. This will allow the rebuild to happen quickly, and avoid slow web > > requests while the cache rebuilds. > > > > The second is a trivial patch to the storeSwapMetaUnpack() function to make > > it initialise a variable. This was causing crashes with COSS when the first > > object in the buffer was broken. > > Cool, you found the crash! Nice! > > Could you re-send the diff in a non-winmail.dat format? :) > They make me use Outlook at work :) Here I go again. Steven
Index: src/store_swapmeta.c =================================================================== RCS file: /cvsroot/squid/squid/src/store_swapmeta.c,v retrieving revision 1.11 diff -u -r1.11 store_swapmeta.c --- src/store_swapmeta.c 20 May 2006 13:36:59 -0000 1.11 +++ src/store_swapmeta.c 27 Jul 2006 07:49:16 -0000 @@ -120,7 +120,7 @@ tlv * storeSwapMetaUnpack(const char *buf, int *hdr_len) { - tlv *TLV; /* we'll return this */ + tlv *TLV = NULL; /* we'll return this */ tlv **T = &TLV; char type; int length;
Index: src/cf.data.pre =================================================================== RCS file: /cvsroot/squid/squid/src/cf.data.pre,v retrieving revision 1.143 diff -u -r1.143 cf.data.pre --- src/cf.data.pre 26 Jul 2006 21:51:20 -0000 1.143 +++ src/cf.data.pre 27 Jul 2006 06:00:24 -0000 @@ -4206,6 +4206,15 @@ do not specify this parameter. DOC_END +NAME: wccp2_rebuild_wait +TYPE: onoff +LOC: Config.Wccp2.rebuildwait +DEFAULT: off +DOC_START + If this is enabled Squid will wait for the cache dir rebuild to finish + before sending the first wccp2 HereIAm packet +DOC_END + NAME: wccp2_forwarding_method TYPE: int LOC: Config.Wccp2.forwarding_method Index: src/structs.h =================================================================== RCS file: /cvsroot/squid/squid/src/structs.h,v retrieving revision 1.122 diff -u -r1.122 structs.h --- src/structs.h 26 Jul 2006 21:51:20 -0000 1.122 +++ src/structs.h 27 Jul 2006 06:00:27 -0000 @@ -506,6 +506,7 @@ struct in_addr address; int forwarding_method; int return_method; + int rebuildwait; void *info; } Wccp2; #endif Index: src/wccp2.c =================================================================== RCS file: /cvsroot/squid/squid/src/wccp2.c,v retrieving revision 1.18 diff -u -r1.18 wccp2.c --- src/wccp2.c 27 Jul 2006 00:50:47 -0000 1.18 +++ src/wccp2.c 27 Jul 2006 06:00:28 -0000 @@ -1058,6 +1058,11 @@ debug(80, 1) ("wccp2HereIam: wccp2 socket closed. Shutting down WCCP2\n"); return; } + /* Wait 10 seconds if store dirs are rebuilding */ + if(store_dirs_rebuilding && Config.Wccp2.rebuildwait) + if (!eventFind(wccp2HereIam, NULL)) + eventAdd("wccp2HereIam", wccp2HereIam, NULL, 10.0, 1); + router_len = sizeof(router); memset(&router, '\0', router_len); router.sin_family = AF_INET;