Bug #11895 --> add protection for preventing multiple get new message calls on the same server.

Don't run pop urls if the server is already busy.
This commit is contained in:
mscott%netscape.com 1999-08-31 06:53:26 +00:00
Родитель 5276387f56
Коммит be68e722a4
2 изменённых файлов: 25 добавлений и 5 удалений

Просмотреть файл

@ -518,7 +518,10 @@ nsresult nsPop3Protocol::LoadUrl(nsIURI* aURL, nsISupports * /* aConsumer */)
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(popServer);
if (server)
{
rv = server->GetLocalPath(&mailDirectory);
server->SetServerBusy(PR_TRUE); // the server is now busy
}
m_pop3ConData->uidlinfo = net_pop3_load_state(host, GetUsername(), mailDirectory);
PL_strfree(mailDirectory);
@ -2650,6 +2653,15 @@ nsresult nsPop3Protocol::ProcessProtocolState(nsIURI * url, nsIInputStream * aIn
if (mailnewsurl)
mailnewsurl->SetUrlState(PR_FALSE, NS_OK);
if (m_nsIPop3Sink)
{
nsCOMPtr<nsIPop3IncomingServer> popServer;
m_nsIPop3Sink->GetPopServer(getter_AddRefs(popServer));
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(popServer);
if (server)
server->SetServerBusy(PR_FALSE); // the server is now busy
}
m_pop3ConData->next_state = POP3_FREE;
break;

Просмотреть файл

@ -219,12 +219,20 @@ nsresult nsPop3Service::RunPopUrl(nsIMsgIncomingServer * aServer, nsIURI * aUrlT
// load up required server information
rv = aServer->GetUsername(getter_Copies(userName));
nsPop3Protocol * protocol = new nsPop3Protocol(aUrlToRun);
if (protocol)
// find out if the server is busy or not...if the server is busy, we are
// *NOT* going to run the url
PRBool serverBusy = PR_FALSE;
rv = aServer->GetServerBusy(&serverBusy);
if (!serverBusy)
{
protocol->SetUsername(userName);
rv = protocol->LoadUrl(aUrlToRun);
}
nsPop3Protocol * protocol = new nsPop3Protocol(aUrlToRun);
if (protocol)
{
protocol->SetUsername(userName);
rv = protocol->LoadUrl(aUrlToRun);
}
}
} // if server
return rv;