Re: Direct only when parent is down, HOW?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 29 Oct 1999 21:36:50 +0200

Sorry. There was two unrelated pieces is in that patch. Wonder why Duane
didn't complain..

Have moved the two unrelated pieces to their respective patches, and now
it applies fine to 2.2.STABLE5.

/Henrik

Markus Eiden wrote:

> Patching file squid/src/peer_select.c using
> Plan A...Hunk #1 failed at 474.1 out of 1 hunks failed--saving rejects
> to
> squid/src/peer_select.c.rej

* Squid-2.2.STABLE2: cache_peer connect timeouts
    This is the last of a series of patches to improve non-ICP peering
    relations. This patch introduces different timeouts for peer connections.
    Both a global peer_connect_timeout option, and a cache_peer
    connect-timeout option. It can be assumed that peers are relatively
    stable, and that the peer is not working properly when it takes "long"
    time to connect to one. Default timeout here is 30 seconds, as opposed
    to the standard connect_timeout of 2 minutes.

Index: squid/src/cache_cf.c
diff -u squid/src/cache_cf.c:1.1.1.29.4.1 squid/src/cache_cf.c:1.1.1.29.4.2
--- squid/src/cache_cf.c:1.1.1.29.4.1 Wed Apr 21 15:03:36 1999
+++ squid/src/cache_cf.c Thu Apr 29 14:41:59 1999
@@ -1047,6 +1047,8 @@
 #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: squid/src/cf.data.pre
diff -u squid/src/cf.data.pre:1.1.1.35.2.1 squid/src/cf.data.pre:1.1.1.35.2.2
--- squid/src/cf.data.pre:1.1.1.35.2.1 Wed Apr 21 15:03:36 1999
+++ squid/src/cf.data.pre Thu Apr 29 14:41:59 1999
@@ -228,6 +228,7 @@
                      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.
@@ -276,6 +277,9 @@
                      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 (see also peer_connect_timeout directive)
+
         NOTE: non-ICP neighbors must be specified as 'parent'.
 
 cache_peer hostname type 3128 3130
@@ -1279,6 +1285,21 @@
         default is two minutes (120 seconds).
 
 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 the connect to a
+ peer cache to complete. The default is 30 seconds. The reason
+ to this is to speed up recovery when a peer cache fails. See also
+ connect-timeout cache_peer option for an per peer specific way
+ to specify this.
+
+peer_connect_timeout 30 seconds
 DOC_END
 
 NAME: siteselect_timeout
Index: squid/src/forward.c
diff -u squid/src/forward.c:1.1.1.11.2.1 squid/src/forward.c:1.1.1.11.2.2
--- squid/src/forward.c:1.1.1.11.2.1 Wed Apr 21 15:03:39 1999
+++ squid/src/forward.c Thu Apr 29 14:42:00 1999
@@ -217,6 +217,8 @@
         err->request = requestLink(fwdState->request);
         err->xerrno = ETIMEDOUT;
         fwdFail(fwdState, err);
+ if (fwdState->servers->peer)
+ peerConnectFailed(fwdState->servers->peer);
     }
     comm_close(fd);
 }
@@ -224,6 +226,7 @@
 static void
 fwdConnectStart(void *data)
 {
+ time_t timeout = Config.Timeout.connect;
     FwdState *fwdState = data;
     const char *url = storeUrl(fwdState->entry);
     int fd;
@@ -237,6 +240,9 @@
     if (fs->peer) {
         host = fs->peer->host;
         port = fs->peer->http_port;
+ timeout = Config.Timeout.peer_connect;
+ if (fs->peer->connect_timeout != 0)
+ timeout = fs->peer->connect_timeout;
     } else {
         host = fwdState->request->host;
         port = fwdState->request->port;
@@ -268,7 +274,7 @@
     fwdState->n_tries++;
     comm_add_close_handler(fd, fwdServerClosed, fwdState);
     commSetTimeout(fd,
- Config.Timeout.connect,
+ timeout,
         fwdConnectTimeout,
         fwdState);
     commConnectStart(fd, host, port, fwdConnectDone, fwdState);
Index: squid/src/structs.h
diff -u squid/src/structs.h:1.1.1.37.6.1 squid/src/structs.h:1.1.1.37.6.2
--- squid/src/structs.h:1.1.1.37.6.1 Wed Apr 21 15:03:43 1999
+++ squid/src/structs.h Thu Apr 29 14:42:00 1999
@@ -246,6 +246,7 @@
         time_t read;
         time_t lifetime;
         time_t connect;
+ time_t peer_connect;
         time_t request;
         time_t pconn;
         time_t siteSelect;
@@ -1069,6 +1070,7 @@
     } carp;
 #endif
     char *login; /* Proxy authorization */
+ time_t connect_timeout;
 };
 
 struct _net_db_name {
Received on Fri Oct 29 1999 - 13:52:57 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:49:08 MST