--------------------- PatchSet 3883 Date: 2006/10/25 23:06:46 Author: rousskov Branch: squid3-icap Tag: (none) Log: - Notify ICAP service of connection failures using the newly added ICAPServiceRep::noteFailure() API. Eventually, other service-related failures should probably be reported so that a broken service can be marked as such [faster]. Members: src/ICAP/ICAPXaction.cc:1.1.2.9->1.1.2.10 src/ICAP/ICAPXaction.h:1.1.2.5->1.1.2.6 Index: squid3/src/ICAP/ICAPXaction.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPXaction.cc,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -u -r1.1.2.9 -r1.1.2.10 --- squid3/src/ICAP/ICAPXaction.cc 9 Oct 2006 17:32:00 -0000 1.1.2.9 +++ squid3/src/ICAP/ICAPXaction.cc 25 Oct 2006 23:06:46 -0000 1.1.2.10 @@ -106,7 +106,7 @@ COMM_NONBLOCKING, s.uri.buf()); if (connection < 0) - throw TexcHere("cannot connect to ICAP service " /* + uri */); + dieOnConnectionFailure(); // throws } debugs(93,3, typeName << " opens connection to " << s.host.buf() << ":" << s.port); @@ -177,7 +177,9 @@ Must(connector); connector = NULL; - Must(commStatus == COMM_OK); + + if (commStatus != COMM_OK) + dieOnConnectionFailure(); // throws fd_table[connection].noteUse(icapPconnPool); @@ -186,6 +188,13 @@ ICAPXaction_Exit(); } +void ICAPXaction::dieOnConnectionFailure() { + theService->noteFailure(); + debugs(93,3, typeName << " failed to connect to the ICAP service at " << + service().uri); + throw TexcHere("cannot connect to the ICAP service"); +} + void ICAPXaction::scheduleWrite(MemBuf &buf) { // comm module will free the buffer Index: squid3/src/ICAP/ICAPXaction.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPXaction.h,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/ICAPXaction.h 9 Oct 2006 17:32:00 -0000 1.1.2.5 +++ squid3/src/ICAP/ICAPXaction.h 25 Oct 2006 23:06:46 -0000 1.1.2.6 @@ -1,6 +1,6 @@ /* - * $Id: ICAPXaction.h,v 1.1.2.5 2006/10/09 17:32:00 rousskov Exp $ + * $Id: ICAPXaction.h,v 1.1.2.6 2006/10/25 23:06:46 rousskov Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -79,6 +79,8 @@ void openConnection(); void closeConnection(); + void dieOnConnectionFailure(); + void scheduleRead(); void scheduleWrite(MemBuf &buf); void updateTimeout();