1 Index: squid/src/cf.data.pre
2 diff -c squid/src/cf.data.pre:1.245.2.53 squid/src/cf.data.pre:1.245.2.54
3 *** squid/src/cf.data.pre:1.245.2.53 Fri Nov 28 12:14:31 2003
4 --- squid/src/cf.data.pre Sat Nov 29 11:52:58 2003
7 NAME: maximum_single_addr_tries
9 LOC: Config.retry.maxtries
12 This sets the maximum number of connection attempts for a
13 host that only has one address (for multiple-address hosts,
14 each address is tried once).
16 ! The default value is three tries, the (not recommended)
17 maximum is 255 tries. A warning message will be generated
18 if it is set to a value greater than ten.
23 NAME: maximum_single_addr_tries
25 LOC: Config.retry.maxtries
28 This sets the maximum number of connection attempts for a
29 host that only has one address (for multiple-address hosts,
30 each address is tried once).
32 ! The default value is one attempt, the (not recommended)
33 maximum is 255 tries. A warning message will be generated
34 if it is set to a value greater than ten.
36 + Note: This is in addition to the request reforwarding which
37 + takes place if Squid fails to get a satisfying response.
44 By combining nonhierarchical_direct off and prefer_direct on you
45 can set up Squid to use a parent as a backup path if going direct
48 + Note: If you want Squid to use parents for all requests then see
49 + the never_direct directive. prefer_direct only modifies how Squid
50 + acts on cachable requests.
53 NAME: strip_query_terms
54 Index: squid/src/comm.c
55 diff -c squid/src/comm.c:1.324.2.2 squid/src/comm.c:1.324.2.3
56 *** squid/src/comm.c:1.324.2.2 Sun Mar 31 23:03:38 2002
57 --- squid/src/comm.c Sat Nov 29 11:52:59 2003
62 struct in_addr in_addr;
72 comm_add_close_handler(fd, commConnectFree, cs);
74 ipcache_nbgethostbyname(host, commConnectDnsHandle, cs);
80 commConnectDnsHandle(const ipcache_addrs * ia, void *data)
82 ConnectStateData *cs = data;
83 - assert(cs->locks == 1);
86 debug(5, 3) ("commConnectDnsHandle: Unknown host: %s\n", cs->host);
87 if (!dns_error_message) {
92 return commResetFD(cs);
96 + commReconnect(void *data)
98 + ConnectStateData *cs = data;
99 + ipcache_nbgethostbyname(cs->host, commConnectDnsHandle, cs);
102 /* Connect SOCK to specified DEST_PORT at DEST_HOST. */
104 commConnectHandle(int fd, void *data)
107 if (Config.onoff.test_reachability)
108 netdbDeleteAddrNetwork(cs->S.sin_addr);
109 if (commRetryConnect(cs)) {
111 ! ipcache_nbgethostbyname(cs->host, commConnectDnsHandle, cs);
113 commConnectCallback(cs, COMM_ERR_CONNECT);
116 if (Config.onoff.test_reachability)
117 netdbDeleteAddrNetwork(cs->S.sin_addr);
118 if (commRetryConnect(cs)) {
119 ! eventAdd("commReconnect", commReconnect, cs, cs->addrcount == 1 ? 0.05 : 0.0, 0);
121 commConnectCallback(cs, COMM_ERR_CONNECT);
123 Index: squid/src/forward.c
124 diff -c squid/src/forward.c:1.82.2.4 squid/src/forward.c:1.82.2.5
125 *** squid/src/forward.c:1.82.2.4 Wed Aug 6 07:49:01 2003
126 --- squid/src/forward.c Sat Nov 29 11:53:00 2003
131 if (fwdState->n_tries > 10)
133 + if (fwdState->origin_tries > 2)
135 if (squid_curtime - fwdState->start > Config.Timeout.connect)
137 if (fwdState->flags.dont_retry)
141 assert(fwdState->server_fd == fd);
142 fwdState->server_fd = -1;
143 if (fwdCheckRetry(fwdState)) {
144 + int originserver = (fwdState->servers->peer == NULL);
145 debug(17, 3) ("fwdServerClosed: re-forwarding (%d tries, %d secs)\n",
147 (int) (squid_curtime - fwdState->start));
150 /* Use next. The last "direct" entry is retried multiple times */
151 fwdState->servers = fs->next;
155 ! /* use eventAdd to break potential call sequence loops */
156 ! eventAdd("fwdConnectStart", fwdConnectStart, fwdState, 0.0, 0);
159 if (!fwdState->err && shutting_down) {
161 /* Use next. The last "direct" entry is retried multiple times */
162 fwdState->servers = fs->next;
167 ! /* use eventAdd to break potential call sequence loops and to slow things down a little */
168 ! eventAdd("fwdConnectStart", fwdConnectStart, fwdState, originserver ? 0.05 : 0.005, 0);
171 if (!fwdState->err && shutting_down) {
175 debug(17, 3) ("fwdConnectStart: reusing pconn FD %d\n", fd);
176 fwdState->server_fd = fd;
179 + fwdState->origin_tries++;
180 comm_add_close_handler(fd, fwdServerClosed, fwdState);
181 fwdConnectDone(fd, COMM_OK, fwdState);
187 fwdState->server_fd = fd;
190 + fwdState->origin_tries++;
192 * stats.conn_open is used to account for the number of
193 * connections that we have open to the peer, so we can limit
199 if (fwdState->n_tries > 9)
201 + if (fwdState->origin_tries > 1)
203 if (fwdState->request->flags.body_sent)
205 Index: squid/src/neighbors.c
206 diff -c squid/src/neighbors.c:1.299.2.3 squid/src/neighbors.c:1.299.2.4
207 *** squid/src/neighbors.c:1.299.2.3 Tue Aug 12 18:28:19 2003
208 --- squid/src/neighbors.c Sat Nov 29 11:53:00 2003
211 static void neighborCountIgnored(peer *);
212 static void peerRefreshDNS(void *);
213 static IPH peerDNSConfigure;
214 ! static void peerProbeConnect(peer *);
215 ! static IPH peerProbeConnect2;
216 static CNCB peerProbeConnectDone;
217 static void peerCountMcastPeersDone(void *data);
218 static void peerCountMcastPeersStart(void *data);
220 static void neighborCountIgnored(peer *);
221 static void peerRefreshDNS(void *);
222 static IPH peerDNSConfigure;
223 ! static int peerProbeConnect(peer *);
224 static CNCB peerProbeConnectDone;
225 static void peerCountMcastPeersDone(void *data);
226 static void peerCountMcastPeersStart(void *data);
230 debug(15, 5) ("peerDigestLookup: gone!\n");
232 - } else if (!peerHTTPOkay(p, request)) {
233 - debug(15, 5) ("peerDigestLookup: !peerHTTPOkay\n");
234 - return LOOKUP_NONE;
235 - } else if (p->digest->flags.usable) {
236 - debug(15, 5) ("peerDigestLookup: usable\n");
237 - /* fall through; put here to have common case on top */ ;
238 } else if (!p->digest->flags.needed) {
239 debug(15, 5) ("peerDigestLookup: note need\n");
240 peerDigestNeeded(p->digest);
243 debug(15, 5) ("peerDigestLookup: !ready && %srequested\n",
244 p->digest->flags.requested ? "" : "!");
247 debug(15, 5) ("peerDigestLookup: OK to lookup peer %s\n", p->host);
248 assert(p->digest->cd);
251 debug(15, 5) ("peerDigestLookup: gone!\n");
253 } else if (!p->digest->flags.needed) {
254 debug(15, 5) ("peerDigestLookup: note need\n");
255 peerDigestNeeded(p->digest);
257 ! } else if (!p->digest->flags.usable) {
258 debug(15, 5) ("peerDigestLookup: !ready && %srequested\n",
259 p->digest->flags.requested ? "" : "!");
261 + } else if (!peerHTTPOkay(p, request)) {
262 + debug(15, 5) ("peerDigestLookup: !peerHTTPOkay\n");
263 + return LOOKUP_NONE;
265 debug(15, 5) ("peerDigestLookup: OK to lookup peer %s\n", p->host);
266 assert(p->digest->cd);
269 neighborUp(const peer * p)
272 ! peerProbeConnect((peer *) p);
275 if (p->options.no_query)
278 neighborUp(const peer * p)
281 ! if (!peerProbeConnect((peer *) p))
284 if (p->options.no_query)
288 eventAddIsh("peerRefreshDNS", peerRefreshDNS, NULL, 3600.0, 1);
292 ! peerConnectFailed(peer * p)
294 p->stats.last_connect_failure = squid_curtime;
296 debug(15, 2) ("TCP connection to %s/%d dead\n", p->host, p->http_port);
299 - debug(15, 1) ("TCP connection to %s/%d failed\n", p->host, p->http_port);
302 debug(15, 1) ("Detected DEAD %s: %s/%d/%d\n",
304 eventAddIsh("peerRefreshDNS", peerRefreshDNS, NULL, 3600.0, 1);
308 ! peerConnectFailedSilent(peer * p)
310 p->stats.last_connect_failure = squid_curtime;
312 debug(15, 2) ("TCP connection to %s/%d dead\n", p->host, p->http_port);
317 debug(15, 1) ("Detected DEAD %s: %s/%d/%d\n",
324 + peerConnectFailed(peer * p)
326 + debug(15, 1) ("TCP connection to %s/%d failed\n", p->host, p->http_port);
327 + peerConnectFailedSilent(p);
331 peerConnectSucceded(peer * p)
336 p->tcp_up = PEER_TCP_MAGIC_COUNT;
340 * peerProbeConnect will be called on dead peers by neighborUp
343 peerProbeConnect(peer * p)
346 if (p->test_fd != -1)
347 ! return; /* probe already running */
348 ! if (squid_curtime - p->stats.last_connect_probe < Config.Timeout.connect)
349 ! return; /* don't probe to often */
350 fd = comm_open(SOCK_STREAM, 0, getOutgoingAddr(NULL),
351 0, COMM_NONBLOCKING, p->host);
355 p->stats.last_connect_probe = squid_curtime;
356 - ipcache_nbgethostbyname(p->host, peerProbeConnect2, p);
360 - peerProbeConnect2(const ipcache_addrs * ianotused, void *data)
363 commConnectStart(p->test_fd,
366 peerProbeConnectDone,
372 p->tcp_up = PEER_TCP_MAGIC_COUNT;
376 + peerProbeConnectTimeout(int fd, void *data)
381 + peerConnectFailedSilent(p);
385 * peerProbeConnect will be called on dead peers by neighborUp
388 peerProbeConnect(peer * p)
391 + time_t ctimeout = p->connect_timeout > 0 ? p->connect_timeout
392 + : Config.Timeout.peer_connect;
393 + int ret = squid_curtime - p->stats.last_connect_failure > ctimeout * 10;
394 if (p->test_fd != -1)
395 ! return ret; /* probe already running */
396 ! if (squid_curtime - p->stats.last_connect_probe == 0)
397 ! return ret; /* don't probe to often */
398 fd = comm_open(SOCK_STREAM, 0, getOutgoingAddr(NULL),
399 0, COMM_NONBLOCKING, p->host);
402 ! commSetTimeout(fd, ctimeout, peerProbeConnectTimeout, p);
404 p->stats.last_connect_probe = squid_curtime;
405 commConnectStart(p->test_fd,
408 peerProbeConnectDone,
416 if (status == COMM_OK) {
417 peerConnectSucceded(p);
419 ! peerConnectFailed(p);
424 if (status == COMM_OK) {
425 peerConnectSucceded(p);
427 ! peerConnectFailedSilent(p);
431 Index: squid/src/structs.h
432 diff -c squid/src/structs.h:1.408.2.15 squid/src/structs.h:1.408.2.16
433 *** squid/src/structs.h:1.408.2.15 Wed Oct 29 17:01:52 2003
434 --- squid/src/structs.h Sat Nov 29 11:53:00 2003
443 http_status last_status;