]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2491: assertion failed: refresh.cc: "age >= 0"
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 25 Apr 2009 01:47:35 +0000 (13:47 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 25 Apr 2009 01:47:35 +0000 (13:47 +1200)
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

index 343c47c604b6c843d7f6c197e9c318fcd06fffa1..ff6f36f78ed42c3c62626bd8bacdc168d81f3aff 100644 (file)
@@ -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)