From: Amos Jeffries Date: Sun, 2 Aug 2009 09:42:00 +0000 (+1200) Subject: Cleanup: Boost helper shutdown debugs and state display X-Git-Tag: SQUID_3_2_0_1~822 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7e0f901f9e577ab6bfbba6402160e05e531ef14;p=thirdparty%2Fsquid.git Cleanup: Boost helper shutdown debugs and state display --- diff --git a/src/helper.cc b/src/helper.cc index 2a233ea457..b4bc36ba9e 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -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_