--------------------- PatchSet 3885 Date: 2006/10/26 05:25:15 Author: rousskov Branch: squid3-icap Tag: (none) Log: - Do not skip essential services that want the URL, even if they are broken, and even when we are trying to select the first "up" service. The selection code should be polished further to avoid two calls (find up service and then find any service) and to remove the misleading mustBeUp parameter. - Polished debugging. Members: src/ICAP/ICAPConfig.cc:1.1.2.5->1.1.2.6 Index: squid3/src/ICAP/ICAPConfig.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPConfig.cc,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- squid3/src/ICAP/ICAPConfig.cc 25 Oct 2006 22:22:44 -0000 1.1.2.5 +++ squid3/src/ICAP/ICAPConfig.cc 26 Oct 2006 05:25:15 -0000 1.1.2.6 @@ -1,6 +1,6 @@ /* - * $Id: ICAPConfig.cc,v 1.1.2.5 2006/10/25 22:22:44 rousskov Exp $ + * $Id: ICAPConfig.cc,v 1.1.2.6 2006/10/26 05:25:15 rousskov Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -279,8 +279,9 @@ ICAPServiceRep::Pointer ICAPAccessCheck::findFirstService(ICAPClass *c, bool mustBeUp) { + const char *what = mustBeUp ? "up " : ""; debugs(93,7,HERE << "looking for the first matching " << - (mustBeUp ? "up " : "") << "service in class " << c->key); + what << "service in class " << c->key); Vector::iterator si; for (si = c->services.begin(); si != c->services.end(); ++si) { @@ -293,29 +294,33 @@ continue; // sending a message to a broken service is likely to cause errors - if (service->broken()) + if (service->bypass && service->broken()) continue; if (service->up()) { // sending a message to a service that does not want it is useless // note that we cannot check wantsUrl for service that is not "up" + // note that even essential services are skipped on unwanted URLs! if (!service->wantsUrl(req->urlpath)) continue; } else if (mustBeUp) { - // the caller asked for an "up" service - continue; + // the caller asked for an "up" service and we can bypass this one + if (service->bypass) + continue; + debugs(93,5,HERE << "cannot skip an essential down service"); + what = "down-but-essential "; } debugs(93,5,HERE << "found first matching " << - (mustBeUp ? "up " : "") << "service in class " << c->key << + what << "service in class " << c->key << ": " << service->key); return service; } debugs(93,5,HERE << "found no matching " << - (mustBeUp ? "up " : "") << "services in class " << c->key); + what << "services in class " << c->key); return ICAPServiceRep::Pointer(); }