fix handling of interrupted news urls wrt connection cache r=sspitzer, sr=alecf 57665

This commit is contained in:
bienvenu%netscape.com 2000-10-27 03:21:02 +00:00
parent 7ef4db2efb
commit c8a5f01f55
3 changed files with 28 additions and 8 deletions

View File

@ -3636,7 +3636,8 @@ PRInt32 nsNNTPProtocol::DisplayNewsRC()
{
SetFlag(NNTP_NEWSRC_PERFORMED);
rv = m_nntpServer->GetNumGroupsNeedingCounts(&m_newsRCListCount);
if (NS_FAILED(rv)) return -1;
if (NS_FAILED(rv))
return -1;
}
nsCOMPtr <nsISupports> currChild;
@ -3645,20 +3646,32 @@ PRInt32 nsNNTPProtocol::DisplayNewsRC()
ClearFlag(NNTP_NEWSRC_PERFORMED);
return -1;
}
else if (!currChild)
{
ClearFlag(NNTP_NEWSRC_PERFORMED);
m_nextState = NEWS_DONE;
return 0;
}
nsCOMPtr<nsIFolder> currFolder;
currFolder = do_QueryInterface(currChild, &rv);
if (NS_FAILED(rv)) return -1;
if (!currFolder) return -1;
if (NS_FAILED(rv))
return -1;
if (!currFolder)
return -1;
m_newsFolder = do_QueryInterface(currFolder, &rv);
if (NS_FAILED(rv)) return -1;
if (!m_newsFolder) return -1;
if (NS_FAILED(rv))
return -1;
if (!m_newsFolder)
return -1;
nsXPIDLString name;
rv = currFolder->GetName(getter_Copies(name));
if (NS_FAILED(rv)) return -1;
if (!name) return -1;
if (NS_FAILED(rv))
return -1;
if (!name)
return -1;
// do I need asciiName?
nsCAutoString asciiName; asciiName.AssignWithConversion(name);
@ -5032,6 +5045,11 @@ nsresult nsNNTPProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inp
// mscott: I've removed the code that used to be here because it involved connection
// management which should now be handled by the netlib module.
// bienvenu: netlib never did handle connection caching, so we need to resurrect this code :-(
if (m_nntpServer)
m_nntpServer->RemoveConnection(this);
m_nextState = NEWS_FREE;
break;

View File

@ -103,6 +103,7 @@ nsMsgNewsFolder::nsMsgNewsFolder(void) : nsMsgLineBuffer(nsnull, PR_FALSE),
mExpungedBytes(0), mGettingNews(PR_FALSE),
mInitialized(PR_FALSE), mOptionLines(""), mUnsubscribedNewsgroupLines(""), mCachedNewsrcLine(nsnull), mGroupUsername(nsnull), mGroupPassword(nsnull)
{
MOZ_COUNT_CTOR(nsNewsFolder); // double count these for now.
/* we're parsing the newsrc file, and the line breaks are platform specific.
* if MSG_LINEBREAK != CRLF, then we aren't looking for CRLF
*/
@ -116,6 +117,7 @@ nsMsgNewsFolder::nsMsgNewsFolder(void) : nsMsgLineBuffer(nsnull, PR_FALSE),
nsMsgNewsFolder::~nsMsgNewsFolder(void)
{
MOZ_COUNT_DTOR(nsNewsFolder);
PR_FREEIF(mCachedNewsrcLine);
PR_FREEIF(mGroupUsername);
PR_FREEIF(mGroupPassword);

View File

@ -639,7 +639,7 @@ nsNntpIncomingServer::GetFirstGroupNeedingCounts(nsISupports **aFirstGroupNeedin
*aFirstGroupNeedingCounts = nsnull;
delete mGroupsEnumerator;
mGroupsEnumerator = nsnull;
return NS_ERROR_FAILURE;
return NS_OK; // this is not an error - it just means we reached the end of the groups.
}
rv = mGroupsEnumerator->GetNext(aFirstGroupNeedingCounts);