]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed up ugly confusion with public keys and RELEASE_REQUEST states.
authorwessels <>
Fri, 21 Aug 1998 14:40:57 +0000 (14:40 +0000)
committerwessels <>
Fri, 21 Aug 1998 14:40:57 +0000 (14:40 +0000)
Some other failed assertions led me to an object with a public cache
key, but which was not being swapped out because the proxy-only option
made us call storeReleaseRequest early (before reading any server reply).

RELEASE_REQUEST objects should never be given public keys.
storeReleaseRequest now clears the ENTRY cachable bit to help ensure
this doesn't happen.

src/http.cc
src/store.cc

index 7ff0e2ac5f022d89dbd53eea95e3f4093b6eced9..5fb413748b852e8a677848edc63a5d7f3ef70cdc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.312 1998/08/21 03:15:17 wessels Exp $
+ * $Id: http.cc,v 1.313 1998/08/21 08:40:57 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -115,8 +115,8 @@ static void
 httpMakePrivate(StoreEntry * entry)
 {
     storeExpireNow(entry);
-    EBIT_CLR(entry->flag, ENTRY_CACHABLE);
     storeReleaseRequest(entry);        /* delete object when not used */
+    /* storeReleaseRequest clears ENTRY_CACHABLE flag */
 }
 
 /* This object may be negatively cached */
index f16e4d0c89212c82d2754e04aeda839642fcaa91..667e031e4213cd315f4e67a530e355b5bc7d385b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.448 1998/08/21 03:15:24 wessels Exp $
+ * $Id: store.cc,v 1.449 1998/08/21 08:40:59 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -232,6 +232,12 @@ storeReleaseRequest(StoreEntry * e)
     assert(storeEntryLocked(e));
     debug(20, 3) ("storeReleaseRequest: '%s'\n", storeKeyText(e->key));
     EBIT_SET(e->flag, RELEASE_REQUEST);
+    /*
+     * Clear cachable flag here because we might get called before
+     * anyone else even looks at the cachability flag.  Also, this
+     * prevents httpMakePublic from really setting a public key.
+     */
+    EBIT_CLR(entry->flag, ENTRY_CACHABLE);
     storeSetPrivateKey(e);
 }
 
@@ -311,6 +317,14 @@ storeSetPublicKey(StoreEntry * e)
     if (e->key && !EBIT_TEST(e->flag, KEY_PRIVATE))
        return;                 /* is already public */
     assert(mem);
+    /*
+     * We can't make RELEASE_REQUEST objects public.  Depending on
+     * when RELEASE_REQUEST gets set, we might not be swapping out
+     * the object.  If we're not swapping out, then subsequent
+     * store clients won't be able to access object data which has
+     * been freed from memory.
+     */
+    assert(!EBIT_TEST(e->flag, RELEASE_REQUEST));
     newkey = storeKeyPublic(mem->url, mem->method);
     if ((e2 = (StoreEntry *) hash_lookup(store_table, newkey))) {
        debug(20, 3) ("storeSetPublicKey: Making old '%s' private.\n", mem->url);