bug 406767 clear invalid cache entries, p=Michal Novotny, r/sr=bzbarsky, a=dveditz

git-svn-id: svn://10.0.0.236/trunk@255769 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dveditz%cruzio.com 2009-01-08 07:49:33 +00:00
parent e3f2bb3ea4
commit e8bb24352b
2 changed files with 9 additions and 1 deletions

View File

@ -1117,6 +1117,7 @@ nsFtpState::R_list() {
if (mResponseCode/100 == 2) {
//(DONE)
mNextState = FTP_COMPLETE;
mDoomCache = PR_FALSE;
return FTP_COMPLETE;
}
return FTP_ERROR;
@ -1940,6 +1941,7 @@ nsFtpState::OnCacheEntryAvailable(nsICacheEntryDescriptor *entry,
if (IsClosed())
return NS_OK;
mDoomCache = PR_TRUE;
mCacheEntry = entry;
if (CanReadCacheEntry() && ReadCacheEntry()) {
mState = FTP_READ_CACHE;
@ -2020,6 +2022,8 @@ nsFtpState::CloseWithStatus(nsresult status)
}
mDataStream = nsnull;
if (mDoomCache && mCacheEntry)
mCacheEntry->Doom();
mCacheEntry = nsnull;
return nsBaseContentStream::CloseWithStatus(status);
@ -2072,6 +2076,7 @@ nsFtpState::ReadCacheEntry()
if (HasPendingCallback())
mDataStream->AsyncWait(this, 0, 0, CallbackTarget());
mDoomCache = PR_FALSE;
return PR_TRUE;
}
@ -2129,8 +2134,10 @@ nsFtpState::CheckCache()
session->OpenCacheEntry(key, accessReq, PR_FALSE,
getter_AddRefs(mCacheEntry));
if (mCacheEntry)
if (mCacheEntry) {
mDoomCache = PR_TRUE;
return PR_FALSE; // great, we're ready to proceed!
}
nsresult rv = session->AsyncOpenCacheEntry(key, accessReq, this);
return NS_SUCCEEDED(rv);

View File

@ -289,6 +289,7 @@ private:
nsCString mControlReadCarryOverBuf;
nsCOMPtr<nsICacheEntryDescriptor> mCacheEntry;
PRPackedBool mDoomCache;
nsCString mSuppliedEntityID;
};