]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Forward-port of STORE_META_OBJSIZE swapout from squid-2
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 27 Oct 2009 23:45:48 +0000 (00:45 +0100)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 27 Oct 2009 23:45:48 +0000 (00:45 +0100)
src/StoreMeta.h
src/store_swapmeta.cc

index 50f3fca36b820e5a948a341c97a45bbede069d6c..ffe12aea19b6ee89a8f92ddebd64ad28ae94834f 100644 (file)
@@ -127,10 +127,6 @@ enum {
      */
     STORE_META_STD_LFS,
 
-    /**
-     \deprecated
-     * Object size, not implemented, squid26 compatibility
-     */
     STORE_META_OBJSIZE,
 
     STORE_META_STOREURL,       /* the store url, if different to the normal URL */
index 1a7be1f587b8c8fb7bf73bb19205f92ea02d2da7..77045253fe8fa3960f16219558414fc02f13ae98 100644 (file)
@@ -61,6 +61,7 @@ storeSwapMetaBuild(StoreEntry * e)
     tlv **T = &TLV;
     const char *url;
     const char *vary;
+    const int64_t objsize = e->objectLen();
     assert(e->mem_obj != NULL);
     assert(e->swap_status == SWAPOUT_WRITING);
     url = e->url();
@@ -88,6 +89,17 @@ storeSwapMetaBuild(StoreEntry * e)
         return NULL;
     }
 
+
+    if (objsize >= 0) {
+       T = StoreMeta::Add(T, t);
+       t = StoreMeta::Factory(STORE_META_OBJSIZE, sizeof(objsize), &objsize);
+
+       if (!t) {
+           storeSwapTLVFree(TLV);
+           return NULL;
+       }
+    }
+
     T = StoreMeta::Add(T, t);
     vary = e->mem_obj->vary_headers;