--------------------- PatchSet 6451 Date: 2005/02/28 11:01:26 Author: oliv3 Branch: icap-2_5 Tag: (none) Log: fix for unreachable services Members: src/icap_common.c:1.1.2.33->1.1.2.34 Index: squid/src/icap_common.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/icap_common.c,v retrieving revision 1.1.2.33 retrieving revision 1.1.2.34 diff -u -r1.1.2.33 -r1.1.2.34 --- squid/src/icap_common.c 19 Nov 2004 09:47:02 -0000 1.1.2.33 +++ squid/src/icap_common.c 28 Feb 2005 11:01:26 -0000 1.1.2.34 @@ -1,5 +1,5 @@ /* - * $Id: icap_common.c,v 1.1.2.33 2004/11/19 09:47:02 oliv3 Exp $ + * $Id: icap_common.c,v 1.1.2.34 2005/02/28 11:01:26 oliv3 Exp $ * * DEBUG: section 81 Internet Content Adaptation Protocol (ICAP) Client * AUTHOR: Geetha Manjunath, Hewlett Packard Company @@ -141,6 +141,8 @@ { icap_service_list *isl_iter; int is_iter; + int nb_unreachable=0; + icap_service * unreachable_one=NULL; debug(81, 8) ("icapService: type=%s\n", icapServiceToStr(type)); if (NULL == r) { @@ -169,13 +171,22 @@ return isl_iter->services[is_iter]; } debug(81, 8) ("icapService: found service %s/id=%d, but it's unreachable. I don't want to use it\n", isl_iter->services[is_iter]->name,is_iter); + unreachable_one = isl_iter->services[is_iter]; + nb_unreachable++; /* FIXME:luc: in response mod, if we return an NULL pointer, user can bypass * the filter, is it normal ? */ } } while (is_iter != isl_iter->last_service_used); } debug(81, 8) ("icapService: no service found\n"); - return NULL; + isl_iter = r->class->isl; + + if (nb_unreachable > 0){ + debug(81, 8) ("All the services are unreachable, returning an unreachable one\n"); + return unreachable_one; + } else { + return NULL; + } } int