]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added peer_connect_timeout option
authorwessels <>
Wed, 5 May 1999 02:49:36 +0000 (02:49 +0000)
committerwessels <>
Wed, 5 May 1999 02:49:36 +0000 (02:49 +0000)
added connect-timeout option too cache_peer directive

src/cache_cf.cc
src/cf.data.pre
src/forward.cc
src/structs.h

index bce0281d608a04656386023ffe7ebbafc5d917a2..af32785b354814059b9bfd1b95920dd3d20a4ef3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.327 1999/04/23 02:57:18 wessels Exp $
+ * $Id: cache_cf.cc,v 1.328 1999/05/04 20:49:36 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -991,6 +991,8 @@ parse_peer(peer ** head)
 #endif
        } else if (!strncasecmp(token, "login=", 6)) {
            p->login = xstrdup(token + 6);
+       } else if (!strncasecmp(token, "connect-timeout=", 16)) {
+           p->connect_timeout = atoi(token + 16);
        } else {
            debug(3, 0) ("parse_peer: token='%s'\n", token);
            self_destruct();
index df32afd1e913585c9b235fc5be831e162c63fda8..b4597a41518b1f040baefec0577eccdf343eb512 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.150 1999/04/30 18:06:34 wessels Exp $
+# $Id: cf.data.pre,v 1.151 1999/05/04 20:49:37 wessels Exp $
 #
 #
 # SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -224,6 +224,7 @@ DOC_START
                     no-netdb-exchange
                     no-delay
                     login=user:password
+                    connect-timeout=nn
 
                     use 'proxy-only' to specify that objects fetched
                     from this cache should not be saved locally.
@@ -272,6 +273,11 @@ DOC_START
                     use 'login=user:password' if this is a personal/workgroup
                     proxy and your parent requires proxy authentication.
 
+                    use 'connect-timeout=nn' to specify a peer
+                    specific connect timeout (also see the
+                    peer_connect_timeout directive)
+
+
        NOTE: non-ICP neighbors must be specified as 'parent'.
 
 cache_peer hostname type 3128 3130
@@ -1113,9 +1119,11 @@ DOC_START
        match, then the default will be used.
 
 Default:
+NOCOMMENT_START
 refresh_pattern                ^ftp:           1440    20%     10080
 refresh_pattern                ^gopher:        1440    0%      1440
 refresh_pattern        .               0       20%     4320
+NOCOMMENT_END
 DOC_END
 
 
@@ -1277,6 +1285,18 @@ DOC_START
 connect_timeout 120 seconds
 DOC_END
 
+NAME: peer_connect_timeout
+COMMENT: time-units
+TYPE: time_t
+LOC: Config.Timeout.peer_connect
+DEFAULT: 30 seconds
+DOC_START
+       This parameter specifies how long to wait for a pending TCP
+       connection to a peer cache.  The default is 30 seconds.   You
+       may also set different timeout values for individual neighbors
+       with the 'connect-timeout' option on a 'cache_peer' line.
+peer_connect_timeout 30 seconds
+
 NAME: siteselect_timeout
 COMMENT: time-units
 TYPE: time_t
index 32c44c6f3db96b2cfecd495087e0f16cace9cd8b..093e3ee9d0f70c9bff0c253c61dfe0ddaaed421d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.57 1999/04/23 02:57:22 wessels Exp $
+ * $Id: forward.cc,v 1.58 1999/05/04 20:49:38 wessels Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -210,6 +210,8 @@ fwdConnectTimeout(int fd, void *data)
        err->request = requestLink(fwdState->request);
        err->xerrno = ETIMEDOUT;
        fwdFail(fwdState, err);
+       if (fwdState->servers->peer)
+           peerConnectFailed(fwdState->servers->peer);
     }
     comm_close(fd);
 }
@@ -224,15 +226,19 @@ fwdConnectStart(void *data)
     FwdServer *fs = fwdState->servers;
     const char *host;
     unsigned short port;
+    time_t ctimeout;
     assert(fs);
     assert(fwdState->server_fd == -1);
     debug(17, 3) ("fwdConnectStart: %s\n", url);
     if (fs->peer) {
        host = fs->peer->host;
        port = fs->peer->http_port;
+       ctimeout = fs->peer->connect_timeout > 0 ? fs->peer->connect_timeout
+           : Config.Timeout.peer_connect;
     } else {
        host = fwdState->request->host;
        port = fwdState->request->port;
+       ctimeout = Config.Timeout.connect;
     }
     hierarchyNote(&fwdState->request->hier, fs->code, host);
     if ((fd = pconnPop(host, port)) >= 0) {
@@ -262,7 +268,7 @@ fwdConnectStart(void *data)
     fwdState->n_tries++;
     comm_add_close_handler(fd, fwdServerClosed, fwdState);
     commSetTimeout(fd,
-       Config.Timeout.connect,
+       ctimeout,
        fwdConnectTimeout,
        fwdState);
     commConnectStart(fd, host, port, fwdConnectDone, fwdState);
index 6edb687378ce29b7997b0b55626eceaa99771e5e..762694f78186f6e0b7ab838a55f03c36140ccab1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.287 1999/05/03 21:55:14 wessels Exp $
+ * $Id: structs.h,v 1.288 1999/05/04 20:49:39 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -240,6 +240,7 @@ struct _SquidConfig {
        time_t read;
        time_t lifetime;
        time_t connect;
+       time_t peer_connect;
        time_t request;
        time_t pconn;
        time_t siteSelect;
@@ -1068,6 +1069,7 @@ struct _peer {
     } carp;
 #endif
     char *login;               /* Proxy authorization */
+    time_t connect_timeout;
 };
 
 struct _net_db_name {