From: wessels <> Date: Wed, 5 May 1999 02:49:36 +0000 (+0000) Subject: Added peer_connect_timeout option X-Git-Tag: SQUID_3_0_PRE1~2221 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f62decda8bd156ff56e909c3ae61de6fd9b5b6b;p=thirdparty%2Fsquid.git Added peer_connect_timeout option added connect-timeout option too cache_peer directive --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index bce0281d60..af32785b35 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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(); diff --git a/src/cf.data.pre b/src/cf.data.pre index df32afd1e9..b4597a4151 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 diff --git a/src/forward.cc b/src/forward.cc index 32c44c6f3d..093e3ee9d0 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -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); diff --git a/src/structs.h b/src/structs.h index 6edb687378..762694f781 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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 {