]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Skip Failure Ratio calculations entirely when ICP is disabled.
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 1 Aug 2012 07:55:18 +0000 (19:55 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 1 Aug 2012 07:55:18 +0000 (19:55 +1200)
Also, mention ICP in the logged error message. unqualified 'HIT' confuses
people (self included) more familiar with the HTTP type of HIT responses.

src/client_side_request.cc

index c41e5427da65194c524c239fa7c762c283cc7508..1c983f6844656969bbc531137ecbf4db2c3ca75e 100644 (file)
@@ -230,13 +230,17 @@ checkFailureRatio(err_type etype, hier_code hcode)
 #define FAILURE_MODE_TIME 300
 #endif
 
+    if (hcode == HIER_NONE)
+        return;
+
+    // don't bother when ICP is disabled.
+    if (Config.Port.icp <= 0)
+        return;
+
     static double magic_factor = 100.0;
     double n_good;
     double n_bad;
 
-    if (hcode == HIER_NONE)
-        return;
-
     n_good = magic_factor / (1.0 + request_failure_ratio);
 
     n_bad = magic_factor - n_good;
@@ -267,7 +271,7 @@ checkFailureRatio(err_type etype, hier_code hcode)
     debugs(33, DBG_CRITICAL, "WARNING: Failure Ratio at "<< std::setw(4)<<
            std::setprecision(3) << request_failure_ratio);
 
-    debugs(33, DBG_CRITICAL, "WARNING: Going into hit-only-mode for " <<
+    debugs(33, DBG_CRITICAL, "WARNING: ICP going into HIT-only mode for " <<
            FAILURE_MODE_TIME / 60 << " minutes...");
 
     hit_only_mode_until = squid_curtime + FAILURE_MODE_TIME;