From a19e4f1a1e34ed07b1ecef8f5bfda9dbda48ba3d Mon Sep 17 00:00:00 2001 From: "cavin%netscape.com" Date: Mon, 11 Jun 2001 20:44:11 +0000 Subject: [PATCH] Fix bug 83486. Remove incomplete cache entry in OnStopReuqest() when failed. r=mscott, sr=bienvenu, a=blizzard@mozilla.org. --- mailnews/news/src/nsNNTPProtocol.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mailnews/news/src/nsNNTPProtocol.cpp b/mailnews/news/src/nsNNTPProtocol.cpp index 959375e93ebe..33221cd2754f 100644 --- a/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mailnews/news/src/nsNNTPProtocol.cpp @@ -1149,7 +1149,21 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer) // stop binding is a "notification" informing us that the stream associated with aURL is going away. NS_IMETHODIMP nsNNTPProtocol::OnStopRequest(nsIRequest *request, nsISupports * aContext, nsresult aStatus) -{ +{ + // If failed, remove incomplete cache entry (and it'll be reloaded next time). + if (NS_FAILED(aStatus) && m_runningURL) + { +#ifdef DEBUG_CAVIN + printf("*** Status failed in nsNNTPProtocol::OnStopRequest(), so clean up cache entry for the running url."); +#endif + nsCOMPtr memCacheEntry; + nsCOMPtr mailnewsurl = do_QueryInterface(m_runningURL); + if (mailnewsurl) + mailnewsurl->GetMemCacheEntry(getter_AddRefs(memCacheEntry)); + if (memCacheEntry) + memCacheEntry->Doom(); + } + nsMsgProtocol::OnStopRequest(request, aContext, aStatus); // nsMsgProtocol::OnStopRequest() has called m_channelListener. There is