--------------------- PatchSet 3929 Date: 2006/11/03 15:54:55 Author: rousskov Branch: squid3-icap Tag: (none) Log: - Polished debugging to help track reasons why Squid marks a service "down". Members: src/ICAP/ICAPServiceRep.cc:1.1.2.10->1.1.2.11 Index: squid3/src/ICAP/ICAPServiceRep.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPServiceRep.cc,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- squid3/src/ICAP/ICAPServiceRep.cc 30 Oct 2006 18:18:48 -0000 1.1.2.10 +++ squid3/src/ICAP/ICAPServiceRep.cc 3 Nov 2006 15:54:55 -0000 1.1.2.11 @@ -333,8 +333,8 @@ void ICAPServiceRep::changeOptions(ICAPOptions *newOptions) { - debugs(93,9, "ICAPService changes options from " << theOptions << " to " << - newOptions); + debugs(93,8, "ICAPService changes options from " << theOptions << " to " << + newOptions << ' ' << status()); delete theOptions; theOptions = newOptions; @@ -385,9 +385,13 @@ /* * Check the ICAP server's date header for clock skew */ - int skew = abs((int)(theOptions->timestamp() - squid_curtime)); - if (skew > theOptions->ttl()) - debugs(93, 1, host.buf() << "'s clock is skewed by " << skew << " seconds!"); + const int skew = (int)(theOptions->timestamp() - squid_curtime); + if (abs(skew) > theOptions->ttl()) { + // TODO: If skew is negative, the option will be considered down + // because of stale options. We should probably change this. + debugs(93, 1, "ICAP service's clock is skewed by " << skew << + " seconds: " << uri.buf()); + } } void ICAPServiceRep::announceStatusChange(const char *downPhrase, bool important) const @@ -398,7 +402,8 @@ const char *what = bypass ? "optional" : "essential"; const char *state = wasAnnouncedUp ? downPhrase : "up"; const int level = important ? 1 : 2; - debugs(93,level, what << " ICAP service is " << state << ": " << uri); + debugs(93,level, what << " ICAP service is " << state << ": " << uri << + ' ' << status()); wasAnnouncedUp = !wasAnnouncedUp; } @@ -494,11 +499,22 @@ if (up()) buf.append("up", 2); - else + else { buf.append("down", 4); + if (!self) + buf.append(",gone", 5); + if (isSuspended) + buf.append(",susp", 5); - if (!self) - buf.append(",gone", 5); + if (!theOptions) + buf.append(",!opt", 5); + else + if (!theOptions->valid()) + buf.append(",!valid", 7); + else + if (!theOptions->fresh()) + buf.append(",stale", 6); + } if (waiting) buf.append(",wait", 5); @@ -507,10 +523,7 @@ buf.append(",notif", 6); if (theSessionFailures > 0) - buf.Printf(",F%d", theSessionFailures); - - if (isSuspended) - buf.append(",susp", 5); + buf.Printf(",fail%d", theSessionFailures); buf.append("]", 1); buf.terminate();