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;
