--------------------- PatchSet 12285 Date: 2008/06/27 21:53:17 Author: hno Branch: SQUID_2_6 Tag: SQUID_2_6_STABLE21 Log: Plug a small "squid -k reconfigure" race in the new round-robin counter management The round-robin clear loop only got started on startup, not if the first round-robin peer was added by a "squid -k reconfigure". Members: src/cache_cf.c:1.463.2.6->1.463.2.7 src/neighbors.c:1.313.2.6->1.313.2.7 src/protos.h:1.520.2.4->1.520.2.5 Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid/squid/src/cache_cf.c,v retrieving revision 1.463.2.6 retrieving revision 1.463.2.7 diff -u -r1.463.2.6 -r1.463.2.7 --- squid/src/cache_cf.c 27 Jun 2008 21:07:15 -0000 1.463.2.6 +++ squid/src/cache_cf.c 27 Jun 2008 21:53:17 -0000 1.463.2.7 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.463.2.6 2008/06/27 21:07:15 hno Exp $ + * $Id: cache_cf.c,v 1.463.2.7 2008/06/27 21:53:17 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1618,7 +1618,6 @@ parse_peer(peer ** head) { char *token = NULL; - void *arg = NULL; /* throwaway arg to make eventAdd happy */ peer *p; p = cbdataAlloc(peer); p->http_port = CACHE_HTTP_PORT; @@ -1810,9 +1809,7 @@ head = &(*head)->next; *head = p; Config.npeers++; - if (!reconfiguring && Config.npeers == 1) { - peerClearRRLoop(arg); - } + peerClearRRStart(); } static void Index: squid/src/neighbors.c =================================================================== RCS file: /cvsroot/squid/squid/src/neighbors.c,v retrieving revision 1.313.2.6 retrieving revision 1.313.2.7 diff -u -r1.313.2.6 -r1.313.2.7 --- squid/src/neighbors.c 27 Jun 2008 21:07:15 -0000 1.313.2.6 +++ squid/src/neighbors.c 27 Jun 2008 21:53:17 -0000 1.313.2.7 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.c,v 1.313.2.6 2008/06/27 21:07:15 hno Exp $ + * $Id: neighbors.c,v 1.313.2.7 2008/06/27 21:53:17 hno Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -285,13 +285,22 @@ } /* This gets called every 5 minutes to clear the round-robin counter. */ -void +static void peerClearRRLoop(void *data) { peerClearRR(); eventAdd("peerClearRR", peerClearRRLoop, data, 5 * 60.0, 0); } +void +peerClearRRStart(void) +{ + static int event_added = 0; + if (!event_added) { + peerClearRRLoop(NULL); + } +} + /* Actually clear the round-robin counter. */ void peerClearRR(void) Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid/squid/src/protos.h,v retrieving revision 1.520.2.4 retrieving revision 1.520.2.5 diff -u -r1.520.2.4 -r1.520.2.5 --- squid/src/protos.h 27 Jun 2008 21:07:15 -0000 1.520.2.4 +++ squid/src/protos.h 27 Jun 2008 21:53:17 -0000 1.520.2.5 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.520.2.4 2008/06/27 21:07:15 hno Exp $ + * $Id: protos.h,v 1.520.2.5 2008/06/27 21:53:17 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -668,7 +668,7 @@ extern peer *peerFindByNameAndPort(const char *, unsigned short); extern peer *getDefaultParent(request_t * request); extern peer *getRoundRobinParent(request_t * request); -EVH peerClearRRLoop; +extern void peerClearRRStart(void); extern void peerClearRR(void); extern peer *getAnyParent(request_t * request); extern lookup_t peerDigestLookup(peer * p, request_t * request);