/// TODO: Rename and make private so only those two methods can call this.
bool checkCachable();
int checkNegativeHit() const;
- int locked() const;
+ int locked() const { return lock_count; }
int validToSend() const;
bool memoryCachable(); ///< checkCachable() and can be cached in memory
e->flush();
e->complete();
e->timestampsSet();
- e->unlock("MimeIcon::created");
+ // MimeIcons are only loaded once, prevent accidental destruction
+ // e->unlock("MimeIcon::created");
debugs(25, 3, "Loaded icon " << url_);
}
eventAdd("storeLateRelease", storeLateRelease, NULL, 0.0, 1);
}
-/* return 1 if a store entry is locked */
-int
-StoreEntry::locked() const
-{
- if (lock_count)
- return 1;
-
- /*
- * SPECIAL, PUBLIC entries should be "locked";
- * XXX: Their owner should lock them then instead of relying on this hack.
- */
- if (EBIT_TEST(flags, ENTRY_SPECIAL))
- if (!EBIT_TEST(flags, KEY_PRIVATE))
- return 1;
-
- return 0;
-}
-
bool
StoreEntry::validLength() const
{
StoreDigestCBlock cblock;
int rebuild_lock = 0; ///< bucket number
StoreEntry * rewrite_lock = nullptr; ///< points to store entry with the digest
+ StoreEntry * publicEntry = nullptr; ///< points to the previous store entry with the digest
StoreSearchPointer theSearch;
int rewrite_offset = 0;
int rebuild_count = 0;
e = sd_state.rewrite_lock;
sd_state.rewrite_offset = 0;
EBIT_SET(e->flags, ENTRY_SPECIAL);
- /* setting public key will purge old digest entry if any */
+ /* setting public key will mark the old digest entry for removal once unlocked */
e->setPublicKey();
+ if (const auto oldEntry = sd_state.publicEntry) {
+ oldEntry->release(true);
+ sd_state.publicEntry = nullptr;
+ oldEntry->unlock("storeDigestRewriteResume");
+ }
+ assert(e->locked());
+ sd_state.publicEntry = e;
/* fake reply */
HttpReply *rep = new HttpReply;
rep->setHeaders(Http::scOkay, "Cache Digest OK",
" (" << std::showpos << (int) (e->expires - squid_curtime) << ")");
/* is this the write order? @?@ */
e->mem_obj->unlinkRequest();
- e->unlock("storeDigestRewriteFinish");
sd_state.rewrite_lock = NULL;
++sd_state.rewrite_count;
eventAdd("storeDigestRewriteStart", storeDigestRewriteStart, NULL, (double)
const char *StoreEntry::url() const STUB_RETVAL(NULL)
bool StoreEntry::checkCachable() STUB_RETVAL(false)
int StoreEntry::checkNegativeHit() const STUB_RETVAL(0)
-int StoreEntry::locked() const STUB_RETVAL(0)
int StoreEntry::validToSend() const STUB_RETVAL(0)
bool StoreEntry::memoryCachable() STUB_RETVAL(false)
void StoreEntry::createMemObject() STUB