Hello,
When offline_mode is turned on, squid doesn't validate any documents in
the cache, but it still tries to perform DNS lookups for the hostnames
in their URLs. This means that it can take (by default) five minutes
before the cached document is shown. The following patch makes DNS
lookups fail immediately when offline_mode is turned on, hence making
offline_mode much more useful.
--- squid-2.4.7/src/dns_internal.c.orig 2001-01-11 19:51:47.000000000 -0500
+++ squid-2.4.7/src/dns_internal.c 2002-07-25 12:47:07.000000000 -0400
@@ -415,13 +415,13 @@
/* name servers went away; reconfiguring or shutting down */
break;
q = n->data;
- if (tvSubDsec(q->sent_t, current_time) < Config.Timeout.idns_retransmit * (1 << q->nsends % nns))
+ if (!Config.onoff.offline && tvSubDsec(q->sent_t, current_time) < Config.Timeout.idns_retransmit * (1 << q->nsends % nns))
break;
debug(78, 3) ("idnsCheckQueue: ID %#04x timeout\n",
q->id);
p = n->prev;
dlinkDelete(&q->lru, &lru_list);
- if (tvSubDsec(q->start_t, current_time) < Config.Timeout.idns_query) {
+ if (!Config.onoff.offline && tvSubDsec(q->start_t, current_time) < Config.Timeout.idns_query) {
idnsSendQuery(q);
} else {
int v = cbdataValid(q->callback_data);
--- fqdncache.c.orig 2002-07-25 13:10:14.000000000 -0400
+++ fqdncache.c 2002-07-25 13:10:22.000000000 -0400
@@ -127,6 +127,8 @@
{
if (f->locks != 0)
return 0;
+ if (Config.onoff.offline)
+ return 1;
if (f->expires > squid_curtime)
return 0;
return 1;
--- ipcache.c.orig 2002-07-25 13:10:12.000000000 -0400
+++ ipcache.c 2002-07-25 13:10:20.000000000 -0400
@@ -134,6 +134,8 @@
{
if (i->locks != 0)
return 0;
+ if (Config.onoff.offline)
+ return 1;
if (i->addrs.count == 0)
if (0 == i->flags.negcached)
return 1;