]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- made icp query timeout configurable. if non-zero in the config file,
authorwessels <>
Fri, 5 Jun 1998 23:34:14 +0000 (23:34 +0000)
committerwessels <>
Fri, 5 Jun 1998 23:34:14 +0000 (23:34 +0000)
  it overrides the automatic value.
- added reload_into_ims hacks from 1.1

src/cf.data.pre
src/client_side.cc
src/enums.h
src/neighbors.cc
src/peer_select.cc
src/protos.h
src/structs.h

index b6033a3a89a23f568e6e53a90e99ff729b772afa..c19854261bb5e590b83e30dfbe0d08a3c924062d 100644 (file)
@@ -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
index f5cbbd6a555059ce5fd1c41892d1b097bc5af5ba..bbc707867cc0398ffd598bf6f88daacf7b3a5e02 100644 (file)
@@ -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 {
index 7f3a16bf9fa91e01857c40f51b9aa12bcbabb995..595d207bb626458b9a81c3b6672306d22700a93f 100644 (file)
@@ -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 {
index f81862eb28bb6929557b5ed926f0139b8ff32488..cadf2f19d1f2add2ba86942ac0ffd2760e7b98a2 100644 (file)
@@ -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);
 }
index f6528008585ab9fb1366ee55d31186fed897be3d..7b12dd8cebe1ca839c05503c108e2e276b94cb34 100644 (file)
@@ -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);
 }
 
index a31effd374b5e8806e0706f8ec7808870b9b8f12..751c0e704702e5246adb8a98a746718a1f945b74 100644 (file)
@@ -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);
index 522fd0e3e7a05eae2866dcca09ff31ecd694a72a..98b55e307d0f03e49366997efad8ad4433dfafea 100644 (file)
@@ -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;
 };