]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added StoreEntry::isAccepting() method to let others know if a StoreEntry
authorwessels <>
Tue, 22 Nov 2005 05:20:12 +0000 (05:20 +0000)
committerwessels <>
Tue, 22 Nov 2005 05:20:12 +0000 (05:20 +0000)
is in a state where it can accept more content.

Added for ICAP integration

src/Store.h
src/store.cc

index 01b29e6994c3ceefc6b1d4933d25a21ffa33857d..b1ac95ef78d82a43561d8d79e66ef7e523a47dc2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: Store.h,v 1.15 2005/01/06 03:22:22 robertc Exp $
+ * $Id: Store.h,v 1.16 2005/11/21 22:20:12 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -66,6 +66,7 @@ public:
     virtual HttpReply const *getReply() const;
     virtual void write (StoreIOBuffer);
     virtual _SQUID_INLINE_ bool isEmpty() const;
+    virtual bool isAccepting() const;
     virtual size_t bytesWanted(Range<size_t> const) const;
     virtual void complete();
     virtual store_client_t storeClientType() const;
index 8f290cc6501c02a012c371fdf1b1c56a947986a3..8659e2dc748b75e5fe3f64b19e3a18375f121c3c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.580 2005/11/05 00:08:32 wessels Exp $
+ * $Id: store.cc,v 1.581 2005/11/21 22:20:12 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -827,6 +827,10 @@ storeAppend(StoreEntry * e, const char *buf, int len)
     StoreIOBuffer tempBuffer;
     tempBuffer.data = (char *)buf;
     tempBuffer.length = len;
+    /*
+     * XXX sigh, offset might be < 0 here, but it gets "corrected"
+     * later.  This offset crap is such a mess.
+     */
     tempBuffer.offset = mem->endOffset() - (e->getReply() ? e->getReply()->hdr_sz : 0);
     e->write(tempBuffer);
 }
@@ -1899,6 +1903,22 @@ StoreEntry::unlink()
     store()->unlink(*this);
 }
 
+/*
+ * return true if the entry is in a state where
+ * it can accept more data (ie with write() method)
+ */
+bool
+StoreEntry::isAccepting() const
+{
+    if (STORE_PENDING != store_status)
+        return false;
+
+    if (EBIT_TEST(flags, ENTRY_ABORTED))
+        return false;
+
+    return true;
+}
+
 /* NullStoreEntry */
 
 NullStoreEntry NullStoreEntry::_instance;