]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: Boost helper shutdown debugs and state display
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 2 Aug 2009 09:42:00 +0000 (21:42 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 2 Aug 2009 09:42:00 +0000 (21:42 +1200)
src/helper.cc

index 2a233ea457605a6f7a4b4a92325ee08be2d5a9a9..b4bc36ba9e0c6af7e6a81dc78dde8b628fdf045f 100644 (file)
@@ -611,13 +611,13 @@ helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp, const char *label
     storeAppendPrintf(sentry, "avg service time: %d msec\n",
                       hlp->stats.avg_svc_time);
     storeAppendPrintf(sentry, "\n");
-    storeAppendPrintf(sentry, "%7s\t%7s\t%7s\t%11s\t%20s\t%s\t%7s\t%7s\t%7s\n",
+    storeAppendPrintf(sentry, "%7s\t%7s\t%7s\t%11s\t%20s\t%6s\t%7s\t%7s\t%7s\n",
                       "#",
                       "FD",
                       "PID",
                       "# Requests",
                       "# Deferred Requests",
-                      "Flags",
+                      "Flags ",
                       "Time",
                       "Offset",
                       "Request");
@@ -626,7 +626,7 @@ helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp, const char *label
         helper_stateful_server *srv = (helper_stateful_server *)link->data;
         double tt = 0.001 * tvSubMsec(srv->dispatch_time,
                                       srv->flags.busy ? current_time : srv->answer_time);
-        storeAppendPrintf(sentry, "%7d\t%7d\t%7d\t%11d\t%20d\t%c%c%c%c%c\t%7.3f\t%7d\t%s\n",
+        storeAppendPrintf(sentry, "%7d\t%7d\t%7d\t%11d\t%20d\t%c%c%c%c%c%c\t%7.3f\t%7d\t%s\n",
                           srv->index + 1,
                           srv->rfd,
                           srv->pid,
@@ -634,7 +634,8 @@ helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp, const char *label
                           (int) srv->deferred_requests,
                           srv->flags.busy ? 'B' : ' ',
                           srv->flags.closing ? 'C' : ' ',
-                          srv->flags.reserved == S_HELPER_RESERVED ? 'R' : (srv->flags.reserved == S_HELPER_DEFERRED ? 'D' : ' '),
+                          srv->flags.reserved == S_HELPER_RESERVED ? 'R' : ' ',
+                          srv->flags.reserved == S_HELPER_DEFERRED ? 'D' : ' ',
                           srv->flags.shutdown ? 'S' : ' ',
                           srv->request ? (srv->request->placeholder ? 'P' : ' ') : ' ',
                                   tt < 0.0 ? 0.0 : tt,
@@ -645,7 +646,8 @@ helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp, const char *label
     storeAppendPrintf(sentry, "\nFlags key:\n\n");
     storeAppendPrintf(sentry, "   B = BUSY\n");
     storeAppendPrintf(sentry, "   C = CLOSING\n");
-    storeAppendPrintf(sentry, "   R = RESERVED or DEFERRED\n");
+    storeAppendPrintf(sentry, "   D = DEFERRED\n");
+    storeAppendPrintf(sentry, "   R = RESERVED\n");
     storeAppendPrintf(sentry, "   S = SHUTDOWN PENDING\n");
     storeAppendPrintf(sentry, "   P = PLACEHOLDER\n");
 }
@@ -753,16 +755,26 @@ helperStatefulShutdown(statefulhelper * hlp)
             continue;
         }
 
-        if (srv->flags.reserved != S_HELPER_FREE) {
-            debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " is RESERVED.");
+        if (srv->flags.reserved == S_HELPER_DEFERRED) {
+            debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " is DEFERRED.");
             continue;
         }
 
         if (srv->deferred_requests) {
-            debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " has DEFERRED requests.");
+            debugs(84, 1, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " has DEFERRED requests but not DEFERRED!!");
             continue;
         }
 
+        if (srv->flags.reserved == S_HELPER_RESERVED) {
+            if (shutting_down) {
+                debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " is RESERVED. Closing anyway.");
+            }
+            else {
+                debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " is RESERVED. Not Shutting Down Yet.");
+                continue;
+            }
+        }
+
         srv->flags.closing = 1;
 #ifdef _SQUID_MSWIN_