From: wessels <> Date: Tue, 22 Nov 2005 05:20:12 +0000 (+0000) Subject: Added StoreEntry::isAccepting() method to let others know if a StoreEntry X-Git-Tag: SQUID_3_0_PRE4~524 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa18a4ca5aa688b22de4e82406ff75b2c2303602;p=thirdparty%2Fsquid.git Added StoreEntry::isAccepting() method to let others know if a StoreEntry is in a state where it can accept more content. Added for ICAP integration --- diff --git a/src/Store.h b/src/Store.h index 01b29e6994..b1ac95ef78 100644 --- a/src/Store.h +++ b/src/Store.h @@ -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 const) const; virtual void complete(); virtual store_client_t storeClientType() const; diff --git a/src/store.cc b/src/store.cc index 8f290cc650..8659e2dc74 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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;