mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
potential fix for imap urls spinning, r/sr=mscott 221023, and add more logging, whitespace cleanup
This commit is contained in:
parent
1227476783
commit
d6629585fb
@ -487,6 +487,7 @@ nsImapIncomingServer::LoadNextQueuedUrl(PRBool *aResult)
|
||||
PRBool removeUrlFromQueue = PR_FALSE;
|
||||
if (aImapUrl)
|
||||
{
|
||||
nsImapProtocol::LogImapUrl("considering playing queued url", aImapUrl);
|
||||
rv = DoomUrlIfChannelHasError(aImapUrl, &removeUrlFromQueue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// if we didn't doom the url, lets run it.
|
||||
@ -496,6 +497,7 @@ nsImapIncomingServer::LoadNextQueuedUrl(PRBool *aResult)
|
||||
NS_IF_ADDREF(aConsumer);
|
||||
|
||||
nsCOMPtr <nsIImapProtocol> protocolInstance ;
|
||||
nsImapProtocol::LogImapUrl("creating protocol instance to play queued url", aImapUrl);
|
||||
rv = CreateImapConnection(nsnull, aImapUrl, getter_AddRefs(protocolInstance));
|
||||
if (NS_SUCCEEDED(rv) && protocolInstance)
|
||||
{
|
||||
@ -510,7 +512,10 @@ nsImapIncomingServer::LoadNextQueuedUrl(PRBool *aResult)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nsImapProtocol::LogImapUrl("failed creating protocol instance to play queued url", aImapUrl);
|
||||
keepGoing = PR_FALSE;
|
||||
}
|
||||
NS_IF_RELEASE(aConsumer);
|
||||
}
|
||||
if (removeUrlFromQueue)
|
||||
|
@ -1348,10 +1348,11 @@ PRBool nsImapProtocol::ProcessCurrentURL()
|
||||
ClearFlag(IMAP_CLEAN_UP_URL_STATE);
|
||||
m_urlInProgress = PR_FALSE;
|
||||
|
||||
if (GetConnectionStatus() >= 0 && imapMailFolderSink)
|
||||
if (imapMailFolderSink)
|
||||
{
|
||||
imapMailFolderSink->PrepareToReleaseObject(copyState);
|
||||
imapMailFolderSink->CopyNextStreamMessage(GetServerStateParser().LastCommandSuccessful(), copyState);
|
||||
imapMailFolderSink->CopyNextStreamMessage(GetServerStateParser().LastCommandSuccessful()
|
||||
&& GetConnectionStatus() >= 0, copyState);
|
||||
copyState = nsnull;
|
||||
imapMailFolderSink->ReleaseObject();
|
||||
imapMailFolderSink = nsnull;
|
||||
@ -1525,16 +1526,15 @@ nsresult nsImapProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
||||
NS_IMETHODIMP nsImapProtocol::IsBusy(PRBool *aIsConnectionBusy,
|
||||
PRBool *isInboxConnection)
|
||||
{
|
||||
if (!aIsConnectionBusy || !isInboxConnection)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (!aIsConnectionBusy || !isInboxConnection)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_LOCK_INSTANCE();
|
||||
nsresult rv = NS_OK;
|
||||
*aIsConnectionBusy = PR_FALSE;
|
||||
*isInboxConnection = PR_FALSE;
|
||||
if (!m_transport)
|
||||
{
|
||||
// ** jt -- something is really wrong kill the thread
|
||||
TellThreadToDie(PR_FALSE);
|
||||
// this connection might not be fully set up yet.
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
else
|
||||
@ -1572,21 +1572,22 @@ NS_IMETHODIMP nsImapProtocol::CanHandleUrl(nsIImapUrl * aImapUrl,
|
||||
*aCanRunUrl = PR_FALSE; // assume guilty until proven otherwise...
|
||||
*hasToWait = PR_FALSE;
|
||||
|
||||
if (DeathSignalReceived())
|
||||
return NS_ERROR_FAILURE;
|
||||
PRBool isBusy = PR_FALSE;
|
||||
PRBool isInboxConnection = PR_FALSE;
|
||||
|
||||
if (!m_transport)
|
||||
{
|
||||
// *** jt -- something is really wrong; it could be the dialer gave up
|
||||
// the connection or ip binding has been release by the operating
|
||||
// system; tell thread to die and return error failure
|
||||
TellThreadToDie(PR_FALSE);
|
||||
// this connection might not be fully set up yet.
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
else
|
||||
else if (m_currentServerCommandTagNumber != 0)
|
||||
{
|
||||
PRBool isAlive;
|
||||
rv = m_transport->IsAlive(&isAlive);
|
||||
// if the transport is not alive, and we've ever sent a command with this connection, kill it.
|
||||
// otherwise, we've probably just not finished setting it so don't kill it!
|
||||
if (NS_FAILED(rv) || !isAlive)
|
||||
{
|
||||
TellThreadToDie(PR_FALSE);
|
||||
@ -1605,7 +1606,7 @@ NS_IMETHODIMP nsImapProtocol::CanHandleUrl(nsIImapUrl * aImapUrl,
|
||||
if (isBusy)
|
||||
{
|
||||
nsImapState curUrlImapState;
|
||||
// NS_ASSERTION(m_runningUrl,"isBusy, but no running url.");
|
||||
NS_ASSERTION(m_runningUrl,"isBusy, but no running url.");
|
||||
if (m_runningUrl)
|
||||
{
|
||||
m_runningUrl->GetRequiredImapState(&curUrlImapState);
|
||||
@ -2522,13 +2523,13 @@ char *nsImapProtocol::CreateEscapedMailboxName(const char *rawName)
|
||||
|
||||
void nsImapProtocol::SelectMailbox(const char *mailboxName)
|
||||
{
|
||||
ProgressEventFunctionUsingId (IMAP_STATUS_SELECTING_MAILBOX);
|
||||
IncrementCommandTagNumber();
|
||||
|
||||
m_closeNeededBeforeSelect = PR_FALSE; // initial value
|
||||
ProgressEventFunctionUsingId (IMAP_STATUS_SELECTING_MAILBOX);
|
||||
IncrementCommandTagNumber();
|
||||
|
||||
m_closeNeededBeforeSelect = PR_FALSE; // initial value
|
||||
GetServerStateParser().ResetFlagInfo(0);
|
||||
char *escapedName = CreateEscapedMailboxName(mailboxName);
|
||||
nsCString commandBuffer(GetServerCommandTag());
|
||||
char *escapedName = CreateEscapedMailboxName(mailboxName);
|
||||
nsCString commandBuffer(GetServerCommandTag());
|
||||
commandBuffer.Append(" select \"");
|
||||
commandBuffer.Append(escapedName);
|
||||
commandBuffer.Append("\"" CRLF);
|
||||
|
@ -368,27 +368,27 @@ public:
|
||||
private:
|
||||
// the following flag is used to determine when a url is currently being run. It is cleared when we
|
||||
// finish processng a url and it is set whenever we call Load on a url
|
||||
PRBool m_urlInProgress;
|
||||
PRBool m_socketIsOpen;
|
||||
PRBool m_gotFEEventCompletion;
|
||||
PRUint32 m_flags; // used to store flag information
|
||||
PRBool m_urlInProgress;
|
||||
PRBool m_socketIsOpen;
|
||||
PRBool m_gotFEEventCompletion;
|
||||
PRUint32 m_flags; // used to store flag information
|
||||
nsCOMPtr<nsIImapUrl> m_runningUrl; // the nsIImapURL that is currently running
|
||||
nsImapAction m_imapAction; // current imap action associated with this connnection...
|
||||
|
||||
nsCString m_hostName;
|
||||
char *m_userName;
|
||||
char *m_serverKey;
|
||||
char *m_dataOutputBuf;
|
||||
nsCString m_hostName;
|
||||
char *m_userName;
|
||||
char *m_serverKey;
|
||||
char *m_dataOutputBuf;
|
||||
nsMsgLineStreamBuffer * m_inputStreamBuffer;
|
||||
PRUint32 m_allocatedSize; // allocated size
|
||||
PRUint32 m_allocatedSize; // allocated size
|
||||
PRUint32 m_totalDataSize; // total data size
|
||||
PRUint32 m_curReadIndex; // current read index
|
||||
nsCAutoString m_trashFolderName;
|
||||
nsCAutoString m_trashFolderName;
|
||||
|
||||
// Ouput stream for writing commands to the socket
|
||||
nsCOMPtr<nsISocketTransport> m_transport;
|
||||
nsCOMPtr<nsIOutputStream> m_outputStream; // this will be obtained from the transport interface
|
||||
nsCOMPtr<nsIInputStream> m_inputStream;
|
||||
nsCOMPtr<nsISocketTransport> m_transport;
|
||||
nsCOMPtr<nsIOutputStream> m_outputStream; // this will be obtained from the transport interface
|
||||
nsCOMPtr<nsIInputStream> m_inputStream;
|
||||
|
||||
nsCOMPtr<nsIInputStream> m_channelInputStream;
|
||||
nsCOMPtr<nsIOutputStream> m_channelOutputStream;
|
||||
@ -415,9 +415,9 @@ private:
|
||||
PRBool m_imapThreadIsRunning;
|
||||
void ImapThreadMainLoop(void);
|
||||
PRBool ImapThreadIsRunning();
|
||||
PRInt32 m_connectionStatus;
|
||||
PRInt32 m_connectionStatus;
|
||||
|
||||
PRBool m_nextUrlReadyToRun;
|
||||
PRBool m_nextUrlReadyToRun;
|
||||
nsWeakPtr m_server;
|
||||
|
||||
nsCOMPtr<nsIImapMailFolderSink> m_imapMailFolderSink;
|
||||
@ -637,12 +637,12 @@ private:
|
||||
kDiscoveringNamespacesOnly,
|
||||
kListingForCreate
|
||||
};
|
||||
EMailboxHierarchyNameState m_hierarchyNameState;
|
||||
EMailboxDiscoverStatus m_discoveryStatus;
|
||||
nsVoidArray m_listedMailboxList;
|
||||
nsVoidArray* m_deletableChildren;
|
||||
PRUint32 m_flagChangeCount;
|
||||
PRTime m_lastCheckTime;
|
||||
EMailboxHierarchyNameState m_hierarchyNameState;
|
||||
EMailboxDiscoverStatus m_discoveryStatus;
|
||||
nsVoidArray m_listedMailboxList;
|
||||
nsVoidArray* m_deletableChildren;
|
||||
PRUint32 m_flagChangeCount;
|
||||
PRTime m_lastCheckTime;
|
||||
|
||||
PRBool CheckNeeded();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user