]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
From: Alex Rousskov <rousskov@ircache.net>
authorwessels <>
Wed, 5 May 1999 01:39:00 +0000 (01:39 +0000)
committerwessels <>
Wed, 5 May 1999 01:39:00 +0000 (01:39 +0000)
Here is a small patch to make Squid more robust if cache or server
clock is skewed. The right thing is probably to make age and
entry->timestamp semi-independant by adding a function that computes an
age based on all info available, including entry->timestamp. The patch
below simply adjusts entry->timestamp so it does not lead to negative
ages later.  If entry->timestamp should be based on "cache time" rather
than "server time", the patch should not have bad side effects.

src/store.cc

index 71a065a74839db50cf8a69d06e7ceb919cd8d343..bc0f2bf4670ee8b6bade73ce1aea98eb924d82b5 100644 (file)
@@ -1,7 +1,7 @@
 
 /*
- * $Id: store.cc,v 1.496 1999/05/04 19:22:28 wessels Exp $
- * $Id: store.cc,v 1.496 1999/05/04 19:22:28 wessels Exp $
+ * $Id: store.cc,v 1.497 1999/05/04 19:39:00 wessels Exp $
+ * $Id: store.cc,v 1.497 1999/05/04 19:39:00 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -1042,10 +1042,10 @@ storeEntryValidToSend(StoreEntry * e)
 void
 storeTimestampsSet(StoreEntry * entry)
 {
-    time_t served_date = -1;
     const HttpReply *reply = entry->mem_obj->reply;
-    served_date = reply->date;
-    if (served_date < 0)
+    time_t served_date = reply->date;
+    /* make sure that 0 <= served_date <= squid_curtime */
+    if (served_date < 0 || served_date > squid_curtime)
        served_date = squid_curtime;
     entry->expires = reply->expires;
     entry->lastmod = reply->last_modified;