--------------------- PatchSet 10661 Date: 2008/07/16 17:42:40 Author: adri Branch: delay_pool_write Tag: (none) Log: Shuffle delayClient to delayClientRequest() Add in an ACL array parameter to delayClientRequest/delayClientReply - so the caller can insert the lookups at strategic places and use different ACL maps to do said lookups. This allows me to reuse these routines. The question is whether I then collapse both into one function and allow the caller to set one, other or both acl arrays. That way I only run over the pool ids once per request, rather than once for request and once for reply (and then both of those for server-side and both of those for client-side writes.) The trouble is that the current calls to delayClientRequest() probably don't -have- the -reply- information available at every callee. I will need to stare at all the points where delayClientRequest() is called and see if I can ensure that there will be a reply available; then I can do request/reply ACLs for delay pools.. Members: src/client_side.c:1.236.2.3->1.236.2.4 src/delay_pools.c:1.21.4.5->1.21.4.6 src/protos.h:1.170.2.2->1.170.2.3 src/ssl.c:1.33->1.33.4.1 src/stat.c:1.48.4.1->1.48.4.2 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.236.2.3 retrieving revision 1.236.2.4 diff -u -r1.236.2.3 -r1.236.2.4 --- squid/src/client_side.c 16 Jul 2008 11:43:01 -0000 1.236.2.3 +++ squid/src/client_side.c 16 Jul 2008 17:42:40 -0000 1.236.2.4 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.236.2.3 2008/07/16 11:43:01 adri Exp $ + * $Id: client_side.c,v 1.236.2.4 2008/07/16 17:42:40 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -400,7 +400,7 @@ h->sc = storeClientRegister(e, h); #if DELAY_POOLS if (h->log_type != LOG_TCP_DENIED) - delaySetStoreClient(h->sc, delayClient(h)); + delaySetStoreClient(h->sc, delayClientRequest(h, Config.Delay.access)); #endif storeClientCopyHeaders(h->sc, e, clientSendHeaders, h); return e; @@ -650,7 +650,7 @@ http->sc = storeClientRegister(entry, http); #if DELAY_POOLS /* delay_id is already set on original store client */ - delaySetStoreClient(http->sc, delayClient(http)); + delaySetStoreClient(http->sc, delayClientRequest(http, Config.Delay.access)); #endif http->entry = entry; http->out.offset = 0; @@ -744,7 +744,7 @@ http->sc = storeClientRegister(entry, http); #if DELAY_POOLS /* delay_id is already set on original store client */ - delaySetStoreClient(http->sc, delayClient(http)); + delaySetStoreClient(http->sc, delayClientRequest(http, Config.Delay.access)); #endif if (can_revalidate && http->old_entry->lastmod > 0) { http->request->lastmod = http->old_entry->lastmod; @@ -2165,7 +2165,7 @@ } #if DELAY_POOLS /* delay_id is already set on original store client */ - delaySetStoreClient(async->sc, delayClient(http)); + delaySetStoreClient(async->sc, delayClientRequest(http, Config.Delay.access)); #endif fwdStart(-1, async->entry, async->request); storeClientRef(async->sc, async->entry, @@ -2878,7 +2878,7 @@ #if DELAY_POOLS /* Write-side Delay Pools: -reply- ACL matching */ - http->delayid = delayClientReply(http); + http->delayid = delayClientReply(http, Config.Delay.accessClientReply); #endif if (http->log_type != LOG_TCP_DENIED && clientReplyBodyTooLarge(http, rep->content_length)) { @@ -3620,7 +3620,7 @@ http->entry->mem_obj->method = r->method; http->sc = storeClientRegister(http->entry, http); #if DELAY_POOLS - delaySetStoreClient(http->sc, delayClient(http)); + delaySetStoreClient(http->sc, delayClientRequest(http, Config.Delay.access)); #endif storeClientCopyHeaders(http->sc, http->entry, clientCacheHit, @@ -5278,7 +5278,7 @@ clientHttpRequest *http = i->data; assert(http); if (http->sc && http->log_type != LOG_TCP_DENIED && http->log_type != LOG_TAG_NONE) - delaySetStoreClient(http->sc, delayClient(http)); + delaySetStoreClient(http->sc, delayClientRequest(http, Config.Delay.access)); if (http->reply) http->delayMaxBodySize = 0; http->delayAssignedPool = 0; Index: squid/src/delay_pools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/delay_pools.c,v retrieving revision 1.21.4.5 retrieving revision 1.21.4.6 diff -u -r1.21.4.5 -r1.21.4.6 --- squid/src/delay_pools.c 16 Jul 2008 14:34:52 -0000 1.21.4.5 +++ squid/src/delay_pools.c 16 Jul 2008 17:42:40 -0000 1.21.4.6 @@ -1,6 +1,6 @@ /* - * $Id: delay_pools.c,v 1.21.4.5 2008/07/16 14:34:52 adri Exp $ + * $Id: delay_pools.c,v 1.21.4.6 2008/07/16 17:42:40 adri Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: David Luyer @@ -319,7 +319,7 @@ * source address. */ delay_id -delayClientReply(clientHttpRequest * http) +delayClientReply(clientHttpRequest * http, acl_access **acl) { request_t *r; aclCheck_t ch; @@ -336,8 +336,8 @@ return delayId(0, 0); } for (pool = 0; pool < Config.Delay.pools; pool++) { - //debug(1, 1) ("delayClientReply: checking pool %d list %p\n", pool, Config.Delay.accessClientReply[pool]); - if (Config.Delay.accessClientReply[pool] && aclCheckFast(Config.Delay.accessClientReply[pool], &ch)) + //debug(1, 1) ("delayClientReply: checking pool %d list %p\n", pool, acl[pool]); + if (acl[pool] && aclCheckFast(acl[pool], &ch)) break; } if (pool == Config.Delay.pools) @@ -353,7 +353,7 @@ * source address. */ delay_id -delayClient(clientHttpRequest * http) +delayClientRequest(clientHttpRequest * http, acl_access **acl) { request_t *r; aclCheck_t ch; @@ -369,7 +369,7 @@ return delayId(0, 0); } for (pool = 0; pool < Config.Delay.pools; pool++) { - if (Config.Delay.access[pool] && aclCheckFast(Config.Delay.access[pool], &ch)) + if (acl[pool] && aclCheckFast(acl[pool], &ch)) break; } if (pool == Config.Delay.pools) Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.170.2.2 retrieving revision 1.170.2.3 diff -u -r1.170.2.2 -r1.170.2.3 --- squid/src/protos.h 16 Jul 2008 11:06:17 -0000 1.170.2.2 +++ squid/src/protos.h 16 Jul 2008 17:42:40 -0000 1.170.2.3 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.170.2.2 2008/07/16 11:06:17 adri Exp $ + * $Id: protos.h,v 1.170.2.3 2008/07/16 17:42:40 adri Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1330,8 +1330,8 @@ extern void delaySetNoDelay(int fd); extern void delayClearNoDelay(int fd); extern int delayIsNoDelay(int fd); -extern delay_id delayClient(clientHttpRequest *); -extern delay_id delayClientReply(clientHttpRequest *); +extern delay_id delayClientRequest(clientHttpRequest *, acl_access **); +extern delay_id delayClientReply(clientHttpRequest *, acl_access **); extern delay_id delayPoolClient(unsigned short pool, in_addr_t client); extern EVH delayPoolsUpdate; extern int delayBytesWanted(delay_id d, int min, int max); Index: squid/src/ssl.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ssl.c,v retrieving revision 1.33 retrieving revision 1.33.4.1 diff -u -r1.33 -r1.33.4.1 --- squid/src/ssl.c 25 Apr 2008 20:55:53 -0000 1.33 +++ squid/src/ssl.c 16 Jul 2008 17:42:40 -0000 1.33.4.1 @@ -1,6 +1,6 @@ /* - * $Id: ssl.c,v 1.33 2008/04/25 20:55:53 squidadm Exp $ + * $Id: ssl.c,v 1.33.4.1 2008/07/16 17:42:40 adri Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -541,7 +541,7 @@ CBDATA_INIT_TYPE(SslStateData); sslState = cbdataAlloc(SslStateData); #if DELAY_POOLS - sslState->delay_id = delayClient(http); + sslState->delay_id = delayClientRequest(http, Config.Delay.access); delayRegisterDelayIdPtr(&sslState->delay_id); #endif sslState->url = xstrdup(url); Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stat.c,v retrieving revision 1.48.4.1 retrieving revision 1.48.4.2 diff -u -r1.48.4.1 -r1.48.4.2 --- squid/src/stat.c 16 Jul 2008 11:05:04 -0000 1.48.4.1 +++ squid/src/stat.c 16 Jul 2008 17:42:40 -0000 1.48.4.2 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.48.4.1 2008/07/16 11:05:04 adri Exp $ + * $Id: stat.c,v 1.48.4.2 2008/07/16 17:42:40 adri Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1524,13 +1524,13 @@ #if DELAY_POOLS if (http->sc) { int pool = (http->sc->delay_id >> 16); - storeAppendPrintf(s, "active delay_pool %d\n", pool); + storeAppendPrintf(s, "active delay_pool %d (id %d)\n", pool, http->sc->delay_id); if (http->delayMaxBodySize > 0) storeAppendPrintf(s, "delayed delay_pool %d; transfer threshold %" PRINTF_OFF_T " bytes\n", http->delayAssignedPool, http->delayMaxBodySize); } - storeAppendPrintf(s, "active write-side delay pool %d\n", http->delayid >> 16); + storeAppendPrintf(s, "active write-side delay pool %d (delay id %d)\n", http->delayid >> 16, http->delayid); #endif storeAppendPrintf(s, "\n"); }