--------------------- PatchSet 11636 Date: 2007/09/05 19:59:32 Author: hno Branch: HEAD Tag: (none) Log: Bug #1980: cache_peer monitortimeout not working This patch implements the cache_peer monitortimeout=N option. The option has been documented and accepted since 2.6.STABLE1, but didn't actually do anything.. Members: src/peer_monitor.c:1.4->1.5 Index: squid/src/peer_monitor.c =================================================================== RCS file: /cvsroot/squid/squid/src/peer_monitor.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- squid/src/peer_monitor.c 21 Jan 2007 12:54:00 -0000 1.4 +++ squid/src/peer_monitor.c 5 Sep 2007 19:59:32 -0000 1.5 @@ -1,6 +1,6 @@ /* - * $Id: peer_monitor.c,v 1.4 2007/01/21 12:54:00 adrian Exp $ + * $Id: peer_monitor.c,v 1.5 2007/09/05 19:59:32 hno Exp $ * * DEBUG: section ?? Peer monitoring * AUTHOR: Henrik Nordstrom @@ -50,6 +50,7 @@ int hdr_size; int offset; char *buf; + int timeout_set; } running; char name[40]; }; @@ -123,6 +124,18 @@ } static void +peerMonitorTimeout(void *data) +{ + PeerMonitor *pm = data; + store_client *sc = pm->running.sc; + pm->running.status = HTTP_REQUEST_TIMEOUT; + pm->running.sc = NULL; + pm->running.timeout_set = 0; + /* This will invoke peerMonitorFetchReplyHeaders which finishes things up */ + storeClientUnregister(sc, pm->running.e, pm); +} + +static void peerMonitorRequest(void *data) { PeerMonitor *pm = data; @@ -145,6 +158,8 @@ return; } pm->last_probe = squid_curtime; + pm->running.timeout_set = 1; + eventAdd(pm->name, peerMonitorTimeout, pm, (double) (pm->peer->monitor.timeout ? pm->peer->monitor.timeout : pm->peer->monitor.interval), 0); httpHeaderPutStr(&req->header, HDR_ACCEPT, "*/*"); httpHeaderPutStr(&req->header, HDR_USER_AGENT, full_appname_string); @@ -168,6 +183,10 @@ storeUnlockObject(pm->running.e); requestUnlink(pm->running.req); memFree(pm->running.buf, MEM_4K_BUF); + if (pm->running.timeout_set) { + eventDelete(peerMonitorTimeout, pm); + pm->running.timeout_set = 0; + } if (!cbdataValid(pm->peer)) { cbdataFree(pm); return;