From 707fdc47436ed27d74f82cd6e8d36dcb5cc5da20 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Tue, 17 Apr 2007 11:40:18 +0000 Subject: [PATCH] Converted objectLen() to a StoreEntry class method. --- src/Store.h | 3 ++- src/client_side.cc | 4 ++-- src/client_side_reply.cc | 4 ++-- src/store.cc | 14 +++++++------- src/store_client.cc | 4 ++-- src/store_dir.cc | 7 +++---- src/store_io.cc | 2 +- src/store_swapout.cc | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Store.h b/src/Store.h index d017e10bdf..cb5572cde9 100644 --- a/src/Store.h +++ b/src/Store.h @@ -1,6 +1,6 @@ /* - * $Id: Store.h,v 1.26 2006/09/03 21:05:20 hno Exp $ + * $Id: Store.h,v 1.27 2007/04/17 05:40:18 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -150,6 +150,7 @@ public: /* reduce the memory lock count on the entry */ virtual int unlock(); /* increate the memory lock count on the entry */ + virtual ssize_t objectLen() const; virtual void lock() diff --git a/src/client_side.cc b/src/client_side.cc index 63b2a9b837..a4b5f9e6f2 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.746 2007/04/15 14:46:15 serassio Exp $ + * $Id: client_side.cc,v 1.747 2007/04/17 05:40:18 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1592,7 +1592,7 @@ ClientSocketContext::writeComplete(int fd, char *bufnotused, size_t size, comm_e assert(fd > -1); debugs(33, 5, "clientWriteComplete: FD " << fd << ", sz " << size << ", err " << errflag << ", off " << http->out.size << ", len " << - entry ? objectLen(entry) : 0); + entry ? entry->objectLen() : 0); clientUpdateSocketStats(http->logType, size); assert (this->fd() == fd); diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index adb97a6cf1..245acbe858 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.116 2007/01/31 23:58:25 wessels Exp $ + * $Id: client_side_reply.cc,v 1.117 2007/04/17 05:40:18 wessels Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -989,7 +989,7 @@ clientReplyContext::checkTransferDone() int clientReplyContext::storeOKTransferDone() const { - if (http->out.offset >= objectLen(http->storeEntry()) - headers_sz) + if (http->out.offset >= http->storeEntry()->objectLen() - headers_sz) return 1; return 0; diff --git a/src/store.cc b/src/store.cc index 777080ad79..924e59d157 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.603 2007/02/07 00:48:15 hno Exp $ + * $Id: store.cc,v 1.604 2007/04/17 05:40:18 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -1384,7 +1384,7 @@ StoreEntry::validLength() const reply = getReply(); debug(20, 3) ("storeEntryValidLength: Checking '%s'\n", getMD5Text()); debugs(20, 5, "storeEntryValidLength: object_len = " << - objectLen(this)); + objectLen()); debug(20, 5) ("storeEntryValidLength: hdr_sz = %d\n", reply->hdr_sz); debug(20, 5) ("storeEntryValidLength: content_length = %d\n", @@ -1414,7 +1414,7 @@ StoreEntry::validLength() const if (reply->sline.status == HTTP_NO_CONTENT) return 1; - diff = reply->hdr_sz + reply->content_length - objectLen(this); + diff = reply->hdr_sz + reply->content_length - objectLen(); if (diff == 0) return 1; @@ -1710,10 +1710,10 @@ StoreEntry::flush() } ssize_t -objectLen(const StoreEntry * e) +StoreEntry::objectLen() const { - assert(e->mem_obj != NULL); - return e->mem_obj->object_sz; + assert(mem_obj != NULL); + return mem_obj->object_sz; } int @@ -1721,7 +1721,7 @@ contentLen(const StoreEntry * e) { assert(e->mem_obj != NULL); assert(e->getReply() != NULL); - return objectLen(e) - e->getReply()->hdr_sz; + return e->objectLen() - e->getReply()->hdr_sz; } diff --git a/src/store_client.cc b/src/store_client.cc index 523c5bda4c..9c2172f458 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.148 2006/09/20 11:38:14 adrian Exp $ + * $Id: store_client.cc,v 1.149 2007/04/17 05:40:18 wessels Exp $ * * DEBUG: section 90 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -282,7 +282,7 @@ storeClientNoMoreToSend(StoreEntry * e, store_client * sc) if (e->store_status == STORE_PENDING) return 0; - if ((len = objectLen(e)) < 0) + if ((len = e->objectLen()) < 0) return 0; if (sc->copyInto.offset < len) diff --git a/src/store_dir.cc b/src/store_dir.cc index 0ec77afcb5..dee2601558 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir.cc,v 1.157 2007/04/10 00:45:10 wessels Exp $ + * $Id: store_dir.cc,v 1.158 2007/04/17 05:40:18 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -188,7 +188,6 @@ storeDirSelectSwapDirRoundRobin(const StoreEntry * e) int i; int load; RefCount sd; - ssize_t objsize = (ssize_t) objectLen(e); for (i = 0; i <= Config.cacheSwap.n_configured; i++) { if (++dirn >= Config.cacheSwap.n_configured) @@ -202,7 +201,7 @@ storeDirSelectSwapDirRoundRobin(const StoreEntry * e) if (sd->cur_size > sd->max_size) continue; - if (!sd->objectSizeIsAcceptable(objsize)) + if (!sd->objectSizeIsAcceptable(e->objectLen())) continue; /* check for error or overload condition */ @@ -244,7 +243,7 @@ storeDirSelectSwapDirLeastLoad(const StoreEntry * e) RefCount SD; /* Calculate the object size */ - objsize = (ssize_t) objectLen(e); + objsize = e->objectLen(); if (objsize != -1) objsize += e->mem_obj->swap_hdr_sz; diff --git a/src/store_io.cc b/src/store_io.cc index 2833693056..f7decc0b3d 100644 --- a/src/store_io.cc +++ b/src/store_io.cc @@ -37,7 +37,7 @@ storeCreate(StoreEntry * e, StoreIOState::STFNCB * file_callback, StoreIOState:: store_io_stats.create.calls++; /* This is just done for logging purposes */ - objsize = objectLen(e); + objsize = e->objectLen(); if (objsize != -1) objsize += e->mem_obj->swap_hdr_sz; diff --git a/src/store_swapout.cc b/src/store_swapout.cc index a531c1b9ae..55e89912fa 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.cc,v 1.108 2006/08/21 00:50:41 robertc Exp $ + * $Id: store_swapout.cc,v 1.109 2007/04/17 05:40:18 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -355,7 +355,7 @@ storeSwapOutFileClosed(void *data, int errflag, StoreIOState::Pointer self) /* swapping complete */ debug(20, 3) ("storeSwapOutFileClosed: SwapOut complete: '%s' to %d, %08X\n", storeUrl(e), e->swap_dirn, e->swap_filen); - e->swap_file_sz = objectLen(e) + mem->swap_hdr_sz; + e->swap_file_sz = e->objectLen() + mem->swap_hdr_sz; e->swap_status = SWAPOUT_DONE; e->store()->updateSize(e->swap_file_sz, 1); -- 2.47.2