--------------------- PatchSet 11706 Date: 2007/09/24 13:31:19 Author: hno Branch: HEAD Tag: (none) Log: Rename Client Socket Buffer (MEM_CLIENT_SOCK_BUF) to Store Client Buffer (MEM_STORE_CLIENT_BUF) This buffer is used for store->client copies, not really related to the socket. s/MEM_CLIENT_SOCK_BUF/MEM_STORE_CLIENT_BUF/g s/MEM_CLIENT_SOCK_BUF/STORE_CLIENT_BUF_SZ/g Members: src/client_side.c:1.739->1.740 src/defines.h:1.125->1.126 src/enums.h:1.239->1.240 src/mem.c:1.76->1.77 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid/squid/src/client_side.c,v retrieving revision 1.739 retrieving revision 1.740 diff -u -r1.739 -r1.740 --- squid/src/client_side.c 22 Sep 2007 16:01:30 -0000 1.739 +++ squid/src/client_side.c 24 Sep 2007 13:31:19 -0000 1.740 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.739 2007/09/22 16:01:30 adrian Exp $ + * $Id: client_side.c,v 1.740 2007/09/24 13:31:19 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -399,7 +399,7 @@ if (h->log_type != LOG_TCP_DENIED) delaySetStoreClient(h->sc, delayClient(h)); #endif - storeClientCopy(h->sc, e, 0, 0, CLIENT_SOCK_SZ, memAllocate(MEM_CLIENT_SOCK_BUF), clientSendMoreHeaderData, h); + storeClientCopy(h->sc, e, 0, 0, STORE_CLIENT_BUF_SZ, memAllocate(MEM_STORE_CLIENT_BUF), clientSendMoreHeaderData, h); return e; } @@ -699,11 +699,11 @@ debug(33, 3) ("clientHandleETagReply: %s, %d bytes\n", url, (int) size); if (entry == NULL) { /* client aborted */ - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } if (size < 0 && !EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientHandleETagMiss(http); return; } @@ -711,22 +711,22 @@ status = mem->reply->sline.status; if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { debug(33, 3) ("clientHandleETagReply: ABORTED '%s'\n", url); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientHandleETagMiss(http); return; } if (STORE_PENDING == entry->store_status && 0 == status) { debug(33, 3) ("clientHandleETagReply: Incomplete headers for '%s'\n", url); - if (size >= CLIENT_SOCK_SZ) { + if (size >= STORE_CLIENT_BUF_SZ) { /* will not get any bigger than that */ debug(33, 3) ("clientHandleETagReply: Reply is too large '%s'\n", url); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientHandleETagMiss(http); } else { storeClientCopy(http->sc, entry, http->out.offset + size, http->out.offset, - CLIENT_SOCK_SZ, + STORE_CLIENT_BUF_SZ, buf, clientHandleETagReply, http); @@ -735,7 +735,7 @@ } if (HTTP_NOT_MODIFIED == mem->reply->sline.status) { /* Remember the ETag and restart */ - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); if (mem->reply) { request_t *request = http->request; const char *etag = httpHeaderGetStr(&mem->reply->header, HDR_ETAG); @@ -780,8 +780,8 @@ storeClientCopy(http->sc, entry, http->out.offset, http->out.offset, - CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + STORE_CLIENT_BUF_SZ, + memAllocate(MEM_STORE_CLIENT_BUF), clientHandleETagReply, http); } @@ -865,8 +865,8 @@ storeClientCopy(http->sc, entry, http->out.offset, http->out.offset, - CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + STORE_CLIENT_BUF_SZ, + memAllocate(MEM_STORE_CLIENT_BUF), clientHandleIMSReply, http); } @@ -946,11 +946,11 @@ http->old_entry->mem_obj->ims_entry = NULL; } if (entry == NULL) { - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } if (size < 0 && !EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } mem = entry->mem_obj; @@ -966,7 +966,7 @@ http->sc = http->old_sc; } else if (STORE_PENDING == entry->store_status && 0 == status) { debug(33, 3) ("clientHandleIMSReply: Incomplete headers for '%s'\n", url); - if (size >= CLIENT_SOCK_SZ) { + if (size >= STORE_CLIENT_BUF_SZ) { /* will not get any bigger than that */ debug(33, 3) ("clientHandleIMSReply: Reply is too large '%s', using old entry\n", url); /* use old entry, this repeats the code abovez */ @@ -980,7 +980,7 @@ storeClientCopy(http->sc, entry, http->out.offset + size, http->out.offset, - CLIENT_SOCK_SZ, + STORE_CLIENT_BUF_SZ, buf, clientHandleIMSReply, http); @@ -1036,7 +1036,7 @@ storeClientCopy(http->sc, entry, http->out.offset, http->out.offset, - CLIENT_SOCK_SZ, + STORE_CLIENT_BUF_SZ, buf, clientSendMoreHeaderData, http); @@ -1119,8 +1119,8 @@ storeClientCopy(http->sc, http->entry, http->out.offset, http->out.offset, - CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + STORE_CLIENT_BUF_SZ, + memAllocate(MEM_STORE_CLIENT_BUF), clientCacheHit, http); return; @@ -2127,12 +2127,12 @@ debug(33, 3) ("clientCacheHit: %s, %d bytes\n", http->uri, (int) size); http->flags.hit = 0; if (http->entry == NULL) { - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); debug(33, 3) ("clientCacheHit: request aborted\n"); return; } else if (size <= 0) { /* swap in failure */ - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); debug(33, 3) ("clientCacheHit: swapin failure for %s\n", http->uri); http->log_type = LOG_TCP_SWAPFAIL_MISS; clientProcessMiss(http); @@ -2143,13 +2143,13 @@ assert(!EBIT_TEST(e->flags, ENTRY_ABORTED)); if (!memHaveHeaders(mem)) { debug(33, 1) ("clientCacheHit: No reply headers in '%s'?\n", e->mem_obj->url); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientProcessMiss(http); return; } if (strcmp(mem->url, urlCanonical(r)) != 0) { debug(33, 1) ("clientCacheHit: URL mismatch '%s' != '%s'?\n", e->mem_obj->url, urlCanonical(r)); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientProcessMiss(http); return; } @@ -2185,7 +2185,7 @@ * so we only get here once. (it also takes care of cancelling loops) */ debug(33, 2) ("clientProcessHit: Vary detected!\n"); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } case VARY_RESTART: @@ -2195,13 +2195,13 @@ safe_free(r->vary_hdr); safe_free(r->vary_headers); clientProcessRequest(http); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; case VARY_CANCEL: /* varyEvaluateMatch found a object loop. Process as miss */ debug(33, 1) ("clientProcessHit: Vary object loop!\n"); clientProcessMiss(http); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } if (r->method == METHOD_PURGE) { @@ -2210,7 +2210,7 @@ http->sc = NULL; storeUnlockObject(e); clientPurgeRequest(http); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } http->flags.hit = 1; @@ -2224,7 +2224,7 @@ clientSendMoreHeaderData(data, buf, size); } else { http->log_type = LOG_TCP_MISS; - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientProcessMiss(http); } return; @@ -2242,7 +2242,7 @@ * Query the origin to see what should be done. */ http->log_type = LOG_TCP_MISS; - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientProcessMiss(http); return; } @@ -2255,7 +2255,7 @@ debug(33, 4) ("clientCacheHit: Reply code %d != 200\n", mem->reply->sline.status); http->log_type = LOG_TCP_MISS; - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientProcessMiss(http); return; } @@ -2321,7 +2321,7 @@ } else { clientProcessExpired(http); } - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } if (is_modified == 0) { @@ -2343,7 +2343,7 @@ storeAppend(e, mb.buf, mb.size); memBufClean(&mb); storeComplete(e); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } /* @@ -2619,7 +2619,7 @@ int fd = conn->fd; HttpReply *rep = NULL; debug(33, 5) ("clientSendMoreHeaderData: %s, %d bytes\n", http->uri, (int) size); - assert(size <= CLIENT_SOCK_SZ); + assert(size <= STORE_CLIENT_BUF_SZ); assert(http->request != NULL); dlinkDelete(&http->active, &ClientActiveRequests); dlinkAdd(http, &http->active, &ClientActiveRequests); @@ -2629,26 +2629,26 @@ if (DLINK_HEAD(conn->reqs) != http) { /* there is another object in progress, defer this one */ debug(33, 2) ("clientSendMoreHeaderData: Deferring %s\n", storeUrl(entry)); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } else if (http->request->flags.reset_tcp) { comm_reset_close(fd); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } else if (entry && EBIT_TEST(entry->flags, ENTRY_ABORTED)) { /* call clientWriteComplete so the client socket gets closed */ - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientWriteComplete(fd, NULL, 0, COMM_OK, http); return; } else if (size < 0) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } else if (size == 0) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } assert(http->out.offset == 0); @@ -2661,7 +2661,7 @@ http->entry = clientCreateStoreEntry(http, http->request->method, null_request_flags); errorAppendEntry(http->entry, err); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } clientMaxBodySize(http->request, http, rep); @@ -2674,7 +2674,7 @@ http->entry = clientCreateStoreEntry(http, http->request->method, null_request_flags); errorAppendEntry(http->entry, err); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } /* @@ -2689,7 +2689,7 @@ */ http->range_iter.prefix_size = rep->hdr_sz; debug(33, 3) ("clientSendMoreHeaderData: %d bytes of headers\n", rep->hdr_sz); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientHttpLocationRewriteCheck(http); } @@ -2889,7 +2889,7 @@ storeClientCopy(http->sc, http->entry, http->out.offset, http->out.offset, - CLIENT_SOCK_SZ, memAllocate(MEM_CLIENT_SOCK_BUF), + STORE_CLIENT_BUF_SZ, memAllocate(MEM_STORE_CLIENT_BUF), clientSendMoreData, http); } @@ -2909,7 +2909,7 @@ int fd = conn->fd; MemBuf mb; debug(33, 5) ("clientSendMoreData: %s, %d bytes\n", http->uri, (int) size); - assert(size <= CLIENT_SOCK_SZ); + assert(size <= STORE_CLIENT_BUF_SZ); assert(http->request != NULL); dlinkDelete(&http->active, &ClientActiveRequests); dlinkAdd(http, &http->active, &ClientActiveRequests); @@ -2919,22 +2919,22 @@ if (DLINK_HEAD(conn->reqs) != http) { /* there is another object in progress, defer this one */ debug(33, 1) ("clientSendMoreData: Deferring %s\n", storeUrl(entry)); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } else if (entry && EBIT_TEST(entry->flags, ENTRY_ABORTED)) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } else if (size < 0) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } else if (size == 0) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); return; } if (!http->request->range) { @@ -2975,11 +2975,11 @@ } /* write body */ comm_write_mbuf(fd, mb, clientWriteComplete, http); - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); } /* - * clientWriteBodyComplete is called for MEM_CLIENT_SOCK_BUF's + * clientWriteBodyComplete is called for MEM_STORE_CLIENT_BUF's * written directly to the client socket, versus copying to a MemBuf * and going through comm_write_mbuf. Most non-range responses after * the headers probably go through here. @@ -2991,7 +2991,7 @@ * NOTE: clientWriteComplete doesn't currently use its "buf" * (second) argument, so we pass in NULL. */ - memFree(buf, MEM_CLIENT_SOCK_BUF); + memFree(buf, MEM_STORE_CLIENT_BUF); clientWriteComplete(fd, NULL, size, errflag, data); } @@ -3042,8 +3042,8 @@ storeClientCopy(http->sc, entry, http->out.offset, http->out.offset, - CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + STORE_CLIENT_BUF_SZ, + memAllocate(MEM_STORE_CLIENT_BUF), clientSendMoreHeaderData, http); } @@ -3127,7 +3127,7 @@ storeClientCopy(http->sc, entry, http->out.offset, http->out.offset, - CLIENT_SOCK_SZ, memAllocate(MEM_CLIENT_SOCK_BUF), + STORE_CLIENT_BUF_SZ, memAllocate(MEM_STORE_CLIENT_BUF), clientSendMoreData, http); } @@ -3352,8 +3352,8 @@ storeClientCopy(http->sc, http->entry, http->out.offset, http->out.offset, - CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), + STORE_CLIENT_BUF_SZ, + memAllocate(MEM_STORE_CLIENT_BUF), clientCacheHit, http); } else { Index: squid/src/defines.h =================================================================== RCS file: /cvsroot/squid/squid/src/defines.h,v retrieving revision 1.125 retrieving revision 1.126 diff -u -r1.125 -r1.126 --- squid/src/defines.h 23 Sep 2007 13:06:08 -0000 1.125 +++ squid/src/defines.h 24 Sep 2007 13:31:19 -0000 1.126 @@ -1,6 +1,6 @@ /* - * $Id: defines.h,v 1.125 2007/09/23 13:06:08 adrian Exp $ + * $Id: defines.h,v 1.126 2007/09/24 13:31:19 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -299,7 +299,7 @@ */ #define PEER_TCP_MAGIC_COUNT 10 -#define CLIENT_SOCK_SZ 4096 +#define STORE_CLIENT_BUF_SZ 4096 #define URI_WHITESPACE_STRIP 0 #define URI_WHITESPACE_ALLOW 1 Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid/squid/src/enums.h,v retrieving revision 1.239 retrieving revision 1.240 diff -u -r1.239 -r1.240 --- squid/src/enums.h 15 Jul 2007 06:16:42 -0000 1.239 +++ squid/src/enums.h 24 Sep 2007 13:31:19 -0000 1.240 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.239 2007/07/15 06:16:42 hno Exp $ + * $Id: enums.h,v 1.240 2007/09/24 13:31:19 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -600,7 +600,7 @@ MEM_CACHE_DIGEST, #endif MEM_CLIENT_INFO, - MEM_CLIENT_SOCK_BUF, + MEM_STORE_CLIENT_BUF, MEM_LINK_LIST, MEM_DLINK_NODE, MEM_DONTFREE, Index: squid/src/mem.c =================================================================== RCS file: /cvsroot/squid/squid/src/mem.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- squid/src/mem.c 22 Sep 2007 16:01:31 -0000 1.76 +++ squid/src/mem.c 24 Sep 2007 13:31:19 -0000 1.77 @@ -1,6 +1,6 @@ /* - * $Id: mem.c,v 1.76 2007/09/22 16:01:31 adrian Exp $ + * $Id: mem.c,v 1.77 2007/09/24 13:31:19 hno Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -311,8 +311,8 @@ memDataNonZero(MEM_32K_BUF); memDataInit(MEM_64K_BUF, "64K Buffer", 65536, 10); memDataNonZero(MEM_64K_BUF); - memDataInit(MEM_CLIENT_SOCK_BUF, "Client Socket Buffer", CLIENT_SOCK_SZ, 0); - memDataNonZero(MEM_CLIENT_SOCK_BUF); + memDataInit(MEM_STORE_CLIENT_BUF, "Store Client Buffer", STORE_CLIENT_BUF_SZ, 0); + memDataNonZero(MEM_STORE_CLIENT_BUF); memDataInit(MEM_ACL, "acl", sizeof(acl), 0); memDataInit(MEM_ACL_DENY_INFO_LIST, "acl_deny_info_list", sizeof(acl_deny_info_list), 0);