From: wessels <> Date: Fri, 5 Jun 1998 23:34:14 +0000 (+0000) Subject: - made icp query timeout configurable. if non-zero in the config file, X-Git-Tag: SQUID_3_0_PRE1~3170 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=465dc4150ba94b05dba1388dd6d0be939085933d;p=thirdparty%2Fsquid.git - made icp query timeout configurable. if non-zero in the config file, it overrides the automatic value. - added reload_into_ims hacks from 1.1 --- diff --git a/src/cf.data.pre b/src/cf.data.pre index b6033a3a89..c19854261b 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -273,19 +273,37 @@ EXAMPLE: neighbor_type_domain cache.foo.org sibling .au .de DOC_END -NAME: neighbor_timeout neighbour_timeout -COMMENT: (seconds) -DEFAULT: 2 seconds -TYPE: time_t -LOC: Config.neighborTimeout +NAME: icp_query_timeout +COMMENT: (msec) +DEFAULT: 0 +TYPE: int +LOC: Config.Timeout.icp_query DOC_START - This controls how long to wait for replies from neighbor caches. - If none of the parent or neighbor caches reply before this many - seconds (due to dropped packets or slow links), then the object - request will be satisfied from the default source. The default - timeout is two seconds. + Normally Squid will automatically determine an optimal ICP + query timeout value based on the round-trip-time of recent ICP + queries. If you want to override the value determined by + Squid, set this 'icp_query_timeout' to a non-zero value. This + value is specified in MILLISECONDS, so, to use a 2-second + timeout (the old default), you would write: -neighbor_timeout 2 seconds + icp_query_timeout 2000 + +icp_query_timeout 0 +DOC_END + +NAME: mcast_icp_query_timeout +COMMENT: (msec) +DEFAULT: 2000 +TYPE: int +LOC: Config.Timeout.mcast_icp_query +DOC_START + For Multicast peers, Squid regularly sends out ICP "probes" to + count how many other peers are listening on the given multicast + address. This value specifies how long Squid should wait to + count all the replies. The default is 2000 msec, or 2 + seconds. + +mcast_icp_query_timeout 2000 DOC_END NAME: dead_peer_timeout @@ -1889,6 +1907,20 @@ DOC_START buffered_logs off DOC_END +NAME: reload_into_ims +COMMENT: on|off +TYPE: onoff +DEFAULT: off +LOC: Config.onoff.reload_into_ims +DOC_START + When you enable this option, client no-cache or ``reload'' + requests will be changed to If-Modified-Since requests. + Doing this VIOLATES the HTTP standard. Enabling this + feature could make you liable for problems which it + causes. +reload_into_ims off +DOC_END + NAME: always_direct TYPE: acl_access LOC: Config.accessList.AlwaysDirect diff --git a/src/client_side.cc b/src/client_side.cc index f5cbbd6a55..bbc707867c 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.331 1998/06/04 20:25:04 rousskov Exp $ + * $Id: client_side.cc,v 1.332 1998/06/05 17:34:16 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -747,8 +747,12 @@ clientInterpretRequestHeaders(clientHttpRequest * http) #endif if (httpHeaderHas(req_hdr, HDR_PRAGMA)) { String s = httpHeaderGetList(req_hdr, HDR_PRAGMA); - if (strListIsMember(&s, "no-cache", ',')) - EBIT_SET(request->flags, REQ_NOCACHE); + if (strListIsMember(&s, "no-cache", ',')) { + if (!Config.onoff.reload_into_ims) + EBIT_SET(request->flags, REQ_NOCACHE); + else + EBIT_SET(request->flags, REQ_NOCACHE_HACK); + } stringClean(&s); } #if OLD_CODE @@ -1910,6 +1914,11 @@ clientProcessRequest2(clientHttpRequest * http) } else if (EBIT_TEST(r->flags, REQ_IMS)) { /* User-initiated IMS request for something we think is valid */ return LOG_TCP_IMS_MISS; + } else if (EBIT_TEST(r->flags, REQ_NOCACHE_HACK)) { + if (r->protocol == PROTO_HTTP) + return LOG_TCP_REFRESH_MISS; + else + return LOG_TCP_MISS; /* XXX zoinks */ } else if (e->mem_status == IN_MEMORY) { return LOG_TCP_MEM_HIT; } else { diff --git a/src/enums.h b/src/enums.h index 7f3a16bf9f..595d207bb6 100644 --- a/src/enums.h +++ b/src/enums.h @@ -476,7 +476,8 @@ enum { REQ_PROXYING, REQ_REFRESH, REQ_USED_PROXY_AUTH, - REQ_REDIRECTED + REQ_REDIRECTED, + REQ_NOCACHE_HACK, /* for changing no-cache requests into IMS */ }; enum { diff --git a/src/neighbors.cc b/src/neighbors.cc index f81862eb28..cadf2f19d1 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.220 1998/06/03 20:34:44 wessels Exp $ + * $Id: neighbors.cc,v 1.221 1998/06/05 17:34:19 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -408,7 +408,7 @@ neighborsUdpPing(request_t * request, IRCB * callback, void *callback_data, int *exprep, - double *exprtt) + int *timeout) { const char *url = storeUrl(entry); MemObject *mem = entry->mem_obj; @@ -428,7 +428,7 @@ neighborsUdpPing(request_t * request, mem->start_ping = current_time; mem->icp_reply_callback = callback; mem->ircb_data = callback_data; - *exprtt = 0.0; + *timeout = 0.0; for (i = 0, p = first_ping; i++ < Config.npeers; p = p->next) { if (p == NULL) p = Config.peers; @@ -490,7 +490,7 @@ neighborsUdpPing(request_t * request, } else if (neighborUp(p)) { /* its alive, expect a reply from it */ (*exprep)++; - (*exprtt) += (double) p->stats.rtt; + (*timeout) += p->stats.rtt; } else { /* Neighbor is dead; ping it anyway, but don't expect a reply */ /* log it once at the threshold */ @@ -536,18 +536,16 @@ neighborsUdpPing(request_t * request, host); } } -#endif -#if LOG_ICP_NUMBERS - request->hierarchy.n_sent = peers_pinged; - request->hierarchy.n_expect = *exprep; #endif /* - * Average out the expected RTT and then double it + * If there is a configured timeout, use it */ - if (*exprep > 0) - (*exprtt) = 2.0 * (*exprtt) / (double) (*exprep); + if (Config.Timeout.icp_query) + *timeout = Config.Timeout.icp_query * 1000; + else if (*exprep > 0) + (*timeout) = 2 * (*timeout) / (*exprep); else - *exprtt = Config.neighborTimeout; + *timeout = 2000; /* 2 seconds */ return peers_pinged; } @@ -1059,7 +1057,7 @@ peerCountMcastPeersStart(void *data) eventAdd("peerCountMcastPeersDone", peerCountMcastPeersDone, psstate, - (double) Config.neighborTimeout, 1); + (double) Config.Timeout.mcast_icp_query, 1); p->mcast.flags |= PEER_COUNTING; peerCountMcastPeersSchedule(p, MCAST_COUNT_RATE); } diff --git a/src/peer_select.cc b/src/peer_select.cc index f652800858..7b12dd8ceb 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.64 1998/05/28 20:47:54 wessels Exp $ + * $Id: peer_select.cc,v 1.65 1998/06/05 17:34:19 wessels Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -201,7 +201,7 @@ peerSelectCallbackFail(ps_state * psstate) debug(44, 1) ("Failed to select source for '%s'\n", url); debug(44, 1) (" always_direct = %d\n", psstate->always_direct); debug(44, 1) (" never_direct = %d\n", psstate->never_direct); - debug(44, 1) (" timeout = %d\n", psstate->icp.timeout); + debug(44, 1) (" timedout = %d\n", psstate->icp.timedout); if (cbdataValid(data)) psstate->fail_callback(NULL, data); cbdataUnlock(data); @@ -240,7 +240,6 @@ peerSelectFoo(ps_state * psstate) StoreEntry *entry = psstate->entry; request_t *request = psstate->request; int direct; - double expected_rtt; debug(44, 3) ("peerSelectFoo: '%s %s'\n", RequestMethodStr[request->method], request->host); @@ -312,17 +311,17 @@ peerSelectFoo(ps_state * psstate) peerHandleIcpReply, psstate, &psstate->icp.n_replies_expected, - &expected_rtt); + &psstate->icp.timeout); if (psstate->icp.n_sent == 0) debug(44, 0) ("WARNING: neighborsUdpPing returned 0\n"); debug(44, 3) ("peerSelectFoo: %d ICP replies expected, RTT %f msec\n", - psstate->icp.n_replies_expected, expected_rtt); + psstate->icp.n_replies_expected, psstate->icp.timeout); if (psstate->icp.n_replies_expected > 0) { entry->ping_status = PING_WAITING; eventAdd("peerPingTimeout", peerPingTimeout, psstate, - expected_rtt / 1000.0, + 0.001 * psstate->icp.timeout, 0); return; } @@ -373,7 +372,7 @@ peerPingTimeout(void *data) debug(44, 3) ("peerPingTimeout: '%s'\n", storeUrl(entry)); entry->ping_status = PING_TIMEOUT; PeerStats.timeouts++; - psstate->icp.timeout = 1; + psstate->icp.timedout = 1; peerSelectFoo(psstate); } diff --git a/src/protos.h b/src/protos.h index a31effd374..751c0e7047 100644 --- a/src/protos.h +++ b/src/protos.h @@ -537,7 +537,7 @@ extern int neighborsUdpPing(request_t *, IRCB * callback, void *data, int *exprep, - double *exprtt); + int *timeout); extern void neighborAddAcl(const char *, const char *); extern void neighborsUdpAck(const cache_key *, icp_common_t *, const struct sockaddr_in *); extern void neighborAdd(const char *, const char *, int, int, int, int, int); diff --git a/src/structs.h b/src/structs.h index 522fd0e3e7..98b55e307d 100644 --- a/src/structs.h +++ b/src/structs.h @@ -192,7 +192,6 @@ struct _SquidConfig { time_t negativeDnsTtl; time_t positiveDnsTtl; time_t shutdownLifetime; - time_t neighborTimeout; struct { time_t read; time_t lifetime; @@ -201,6 +200,8 @@ struct _SquidConfig { time_t pconn; time_t siteSelect; time_t deadPeer; + int icp_query; /* msec */ + int mcast_icp_query; /* msec */ } Timeout; size_t maxRequestSize; struct { @@ -321,6 +322,7 @@ struct _SquidConfig { int mem_pools; int test_reachability; int half_closed_clients; + int reload_into_ims; } onoff; acl *aclList; struct { @@ -640,7 +642,8 @@ struct _icp_ping_data { int n_sent; int n_recv; int n_replies_expected; - int timeout; + int timeout; /* msec */ + int timedout; int w_rtt; int p_rtt; };