--------------------- PatchSet 7187 Date: 2005/12/06 21:53:44 Author: dwsquid Branch: icap-2_5 Tag: (none) Log: This patch eliminates a double call to icapService() for REQMOD PRECACHE. It was called first from clientIcapReqMod() and then again immediately from icapReqModStart(). With this patch it is called only from clientIcapReqMod() and then the service is passed as a parameter to icapReqModStart(). Members: src/client_side.c:1.47.2.28.2.39->1.47.2.28.2.40 src/icap_reqmod.c:1.1.2.57->1.1.2.58 src/protos.h:1.41.6.13.2.36->1.41.6.13.2.37 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.47.2.28.2.39 retrieving revision 1.47.2.28.2.40 diff -u -r1.47.2.28.2.39 -r1.47.2.28.2.40 --- squid/src/client_side.c 1 Dec 2005 00:37:09 -0000 1.47.2.28.2.39 +++ squid/src/client_side.c 6 Dec 2005 21:53:44 -0000 1.47.2.28.2.40 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.47.2.28.2.39 2005/12/01 00:37:09 dwsquid Exp $ + * $Id: client_side.c,v 1.47.2.28.2.40 2005/12/06 21:53:44 dwsquid Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -3991,9 +3991,10 @@ clientIcapReqMod(clientHttpRequest * http) { ErrorState *err; + icap_service *service; if (http->flags.did_icap_reqmod) return 0; - if (NULL == icapService(ICAP_SERVICE_REQMOD_PRECACHE, http->request)) + if (NULL == (service = icapService(ICAP_SERVICE_REQMOD_PRECACHE, http->request))) return 0; debug(33, 3) ("clientIcapReqMod: calling icapReqModStart for %p\n", http); /* @@ -4003,7 +4004,7 @@ * 'clientHttpRequest' does not get logged because its out.size * is zero and log_type is unset. */ - http->icap_reqmod = icapReqModStart(ICAP_SERVICE_REQMOD_PRECACHE, + http->icap_reqmod = icapReqModStart(service, http->uri, http->request, http->conn->fd, Index: squid/src/icap_reqmod.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/icap_reqmod.c,v retrieving revision 1.1.2.57 retrieving revision 1.1.2.58 diff -u -r1.1.2.57 -r1.1.2.58 --- squid/src/icap_reqmod.c 30 Nov 2005 23:39:54 -0000 1.1.2.57 +++ squid/src/icap_reqmod.c 6 Dec 2005 21:53:44 -0000 1.1.2.58 @@ -1,6 +1,6 @@ /* - * $Id: icap_reqmod.c,v 1.1.2.57 2005/11/30 23:39:54 dwsquid Exp $ + * $Id: icap_reqmod.c,v 1.1.2.58 2005/12/06 21:53:44 dwsquid Exp $ * * DEBUG: section 81 Internet Content Adaptation Protocol (ICAP) Client * AUTHOR: Geetha Manjunath, Hewlett Packard Company @@ -725,26 +725,19 @@ * structure and request a TCP connection to the server. */ IcapStateData * -icapReqModStart(icap_service_t type, const char *uri, request_t * request, +icapReqModStart(icap_service *service, const char *uri, request_t * request, int fd, struct timeval start, struct in_addr log_addr, void *cookie) { IcapStateData *icap = NULL; - icap_service *service = NULL; - debug(81, 3) ("icapReqModStart: type=%d\n", (int) type); - assert(type >= 0 && type < ICAP_SERVICE_MAX); + debug(81, 3) ("icapReqModStart: type=%d\n", (int) service->type); - service = icapService(type, request); - if (!service) { - debug(81, 3) ("icapReqModStart: no service found\n"); - return NULL; /* no service found */ - } - switch (type) { + switch (service->type) { case ICAP_SERVICE_REQMOD_PRECACHE: break; default: fatalf("icapReqModStart: unsupported service type '%s'\n", - icap_service_type_str[type]); + icap_service_type_str[service->type]); break; } Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.41.6.13.2.36 retrieving revision 1.41.6.13.2.37 diff -u -r1.41.6.13.2.36 -r1.41.6.13.2.37 --- squid/src/protos.h 23 Nov 2005 20:34:34 -0000 1.41.6.13.2.36 +++ squid/src/protos.h 6 Dec 2005 21:53:44 -0000 1.41.6.13.2.37 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.41.6.13.2.36 2005/11/23 20:34:34 dwsquid Exp $ + * $Id: protos.h,v 1.41.6.13.2.37 2005/12/06 21:53:44 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1379,7 +1379,7 @@ /* * icap_reqmod.c */ -IcapStateData *icapReqModStart(icap_service_t, const char *, request_t *, int, struct timeval, struct in_addr, void *); +IcapStateData *icapReqModStart(icap_service*, const char *, request_t *, int, struct timeval, struct in_addr, void *); /* icap_opt.c */ void icapOptInit(void);