From: wessels <> Date: Wed, 5 May 1999 01:39:00 +0000 (+0000) Subject: From: Alex Rousskov X-Git-Tag: SQUID_3_0_PRE1~2223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f58241dd405687d95f63af695ed1dd04e0d1c94;p=thirdparty%2Fsquid.git From: Alex Rousskov 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. --- diff --git a/src/store.cc b/src/store.cc index 71a065a748..bc0f2bf467 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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;