]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Skip Failure Ratio calculations entirely when ICP is disabled.
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 2 Aug 2012 11:44:57 +0000 (05:44 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 2 Aug 2012 11:44:57 +0000 (05:44 -0600)
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 77ca97df2ae35b194002258d21979239de60ac9e..dd331eaffa0134eafa58939e6dfc8484043c6835 100644 (file)
@@ -209,13 +209,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;
@@ -246,7 +250,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;