From e8bb24352b6ebcefd16db9bd8545e967f2c0883e Mon Sep 17 00:00:00 2001 From: "dveditz%cruzio.com" Date: Thu, 8 Jan 2009 07:49:33 +0000 Subject: [PATCH] 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 --- .../netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp | 9 ++++++++- mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index 14a58db48af..b3631bec4be 100644 --- a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -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); diff --git a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.h b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.h index 55be541d1ba..4587066d4f5 100644 --- a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.h +++ b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.h @@ -289,6 +289,7 @@ private: nsCString mControlReadCarryOverBuf; nsCOMPtr mCacheEntry; + PRPackedBool mDoomCache; nsCString mSuppliedEntityID; };