Modified retry patch - TTL quirk fix - apply to 1.1.10

From: Michael Pelletier <>
Date: Tue, 8 Jul 1997 16:54:22 -0400 (EDT)

I've placed a modified patch (to apply to an unmodified 1.1.10 -- ie, not
a patch to the original patch) at

The essence of the fix was minor changes in two places in ipcache.c -- in
case you want to make the change by hand to your patched Squid 1.1.10,
first to move the line:

       i->expires = squid_curtime + Config.positiveDnsTtl;

(which resets the TTL) from the end of the ipcacheMarkBadAddr() function
(around line 1098 in the patched version) to immediately after the

  if (ia->badcount != ia->count) { /* at least one good address left */

(line 1091) since if there's still a good address, we want to re-extend
the TTL, and to add the same "i->expires" line to the
ipcacheMarkGoodAddr() function just before the line (~1116):

     if (ia->bad_addrs[k]) {

Thus, if all the addresses are bad, the TTL is not reset no matter how
often it's accessed, but if there's one good address left, or a previously
bad address is marked good again upon a sucessful connection, then the TTL
is reset.

As for the stability of this patch -- it had been up and running for a
week until I restarted to implement this TTL fix, after 145,690
connections. One thing I would recommend when running this version is to
increase your "ipcache_size" config file item to something fairly large --
since things don't get punted out of the cache when they're refusing
connections, your high water mark for ipcache entries will inevitably be
higher than without this patch.

        -Mike Pelletier.
Received on Tue Jul 08 1997 - 13:58:00 MDT

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