From 3f6afb5c461da885ff3beff2f8958c3504162b9f Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 25 Apr 2009 13:47:35 +1200 Subject: [PATCH] Bug 2491: assertion failed: refresh.cc: "age >= 0" Assertion was in the wrong place. If seen in Squid after this patch please re-open the bug report and provide more details to track it down. --- src/refresh.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/refresh.cc b/src/refresh.cc index 343c47c604..ff6f36f78e 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -113,7 +113,7 @@ refreshCounts[rcCount]; static const refresh_t *refreshUncompiledPattern(const char *); static OBJH refreshStats; -static int refreshStaleness(const StoreEntry *, time_t, time_t, const refresh_t *, stale_flags *); +static int refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age, const refresh_t * R, stale_flags * sf); static refresh_t DefaultRefresh; @@ -158,12 +158,11 @@ refreshUncompiledPattern(const char *pat) * times. */ static int -refreshStaleness(const StoreEntry * entry, time_t check_time, time_t age, const refresh_t * R, stale_flags * sf) +refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age, const refresh_t * R, stale_flags * sf) { /* * Check for an explicit expiration time. */ - if (entry->expires > -1) { sf->expires = true; @@ -180,12 +179,10 @@ refreshStaleness(const StoreEntry * entry, time_t check_time, time_t age, const } } - assert(age >= 0); - /* + /** \par * Use local heuristics to determine staleness. Start with the * max age from the refresh_pattern rule. */ - if (age > R->max) { debugs(22, 3, "STALE: age " << age << " > max " << R->max << " "); sf->max = true; @@ -251,6 +248,8 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta) if (check_time > entry->timestamp) age = check_time - entry->timestamp; + assert(age >= 0); + R = uri ? refreshLimits(uri) : refreshUncompiledPattern("."); if (NULL == R) -- 2.47.2