From be68e722a4cbb19bf10d3a1f991ad452dfd926f8 Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Tue, 31 Aug 1999 06:53:26 +0000 Subject: [PATCH] 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. --- mailnews/local/src/nsPop3Protocol.cpp | 12 ++++++++++++ mailnews/local/src/nsPop3Service.cpp | 18 +++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/mailnews/local/src/nsPop3Protocol.cpp b/mailnews/local/src/nsPop3Protocol.cpp index bdd609fe844..055eaaf65ad 100644 --- a/mailnews/local/src/nsPop3Protocol.cpp +++ b/mailnews/local/src/nsPop3Protocol.cpp @@ -518,7 +518,10 @@ nsresult nsPop3Protocol::LoadUrl(nsIURI* aURL, nsISupports * /* aConsumer */) nsCOMPtr 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 popServer; + m_nsIPop3Sink->GetPopServer(getter_AddRefs(popServer)); + nsCOMPtr server = do_QueryInterface(popServer); + if (server) + server->SetServerBusy(PR_FALSE); // the server is now busy + } + m_pop3ConData->next_state = POP3_FREE; break; diff --git a/mailnews/local/src/nsPop3Service.cpp b/mailnews/local/src/nsPop3Service.cpp index 2fdfa891551..0b05f8e9f04 100644 --- a/mailnews/local/src/nsPop3Service.cpp +++ b/mailnews/local/src/nsPop3Service.cpp @@ -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;