]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Converted objectLen() to a StoreEntry class method.
authorwessels <>
Tue, 17 Apr 2007 11:40:18 +0000 (11:40 +0000)
committerwessels <>
Tue, 17 Apr 2007 11:40:18 +0000 (11:40 +0000)
src/Store.h
src/client_side.cc
src/client_side_reply.cc
src/store.cc
src/store_client.cc
src/store_dir.cc
src/store_io.cc
src/store_swapout.cc

index d017e10bdf3c2b2bd993d9c04d3e660f9af1083e..cb5572cde9d89fb64e1bb4b3f79732ee5aa91b04 100644 (file)
@@ -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()
 
index 63b2a9b8374034015a887c97d9b9b46fbc50c93f..a4b5f9e6f2dc3829e4390c0cd864a7b35e409d0f 100644 (file)
@@ -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);
 
index adb97a6cf17f39a69bf961362624dd5624784c33..245acbe858746123d914020f5afde6d81bd72f54 100644 (file)
@@ -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;
index 777080ad79cec8ce7fbf756eeef4705a689cde65..924e59d1577eaec61dc900b96cd14c0211206f1e 100644 (file)
@@ -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;
 
 }
 
index 523c5bda4cc8f56930c98a2e8855349ee77b1901..9c2172f4582b6826039c11880c8be1c2a7445cf1 100644 (file)
@@ -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)
index 0ec77afcb5acebbaefe99d8c51d3d7ec80362f1f..dee260155840535a550342db4514baefb01beb3d 100644 (file)
@@ -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<SwapDir> 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<SwapDir> SD;
 
     /* Calculate the object size */
-    objsize = (ssize_t) objectLen(e);
+    objsize = e->objectLen();
 
     if (objsize != -1)
         objsize += e->mem_obj->swap_hdr_sz;
index 2833693056ee78ddec71455f21edcfb804e4a1d6..f7decc0b3df1bc11521bf6784bdc6ecb368a15ad 100644 (file)
@@ -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;
index a531c1b9ae2c1d954e3c5c3a432c2c957a0b0ee4..55e89912fa415ab763a9d65113b91269887af6fb 100644 (file)
@@ -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);