зеркало из https://github.com/mozilla/gecko-dev.git
Bug #5781 --> more connection cache fixes. ProcessCurrentUrl wasn't set up to run multiple urls as it was setting the connection status to -1 whenever it finished. This was causing the next call to process current url to fall out. I also re-organized SetupUrl to make sure m_runningUrl gets properly initialized on multiple calls to LoadUrl.
This commit is contained in:
Родитель
df1cfa52bc
Коммит
7ad6636651
|
@ -476,15 +476,11 @@ nsImapProtocol::SetupSinkProxy()
|
||||||
void nsImapProtocol::SetupWithUrl(nsIURL * aURL)
|
void nsImapProtocol::SetupWithUrl(nsIURL * aURL)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aURL, "null URL passed into Imap Protocol");
|
NS_PRECONDITION(aURL, "null URL passed into Imap Protocol");
|
||||||
|
NS_IF_RELEASE(m_runningUrl);
|
||||||
// query the URL for a nsIImapUrl
|
|
||||||
m_runningUrl = nsnull; // initialize to NULL
|
|
||||||
m_transport = nsnull;
|
|
||||||
|
|
||||||
if (aURL)
|
if (aURL)
|
||||||
{
|
{
|
||||||
nsresult rv = aURL->QueryInterface(nsIImapUrl::GetIID(), (void **)&m_runningUrl);
|
nsresult rv = aURL->QueryInterface(nsIImapUrl::GetIID(), (void **)&m_runningUrl);
|
||||||
if (NS_SUCCEEDED(rv) && m_runningUrl)
|
if (NS_SUCCEEDED(rv) && m_runningUrl && !m_transport /* and we don't have a transport yet */)
|
||||||
{
|
{
|
||||||
// extract the file name and create a file transport...
|
// extract the file name and create a file transport...
|
||||||
const char * hostName = nsnull;
|
const char * hostName = nsnull;
|
||||||
|
@ -495,11 +491,6 @@ void nsImapProtocol::SetupWithUrl(nsIURL * aURL)
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && pNetService)
|
if (NS_SUCCEEDED(rv) && pNetService)
|
||||||
rv = pNetService->CreateSocketTransport(&m_transport, port, GetImapHostName());
|
rv = pNetService->CreateSocketTransport(&m_transport, port, GetImapHostName());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_outputStream = NULL;
|
|
||||||
m_outputConsumer = NULL;
|
|
||||||
|
|
||||||
nsresult rv = m_transport->GetOutputStream(&m_outputStream);
|
nsresult rv = m_transport->GetOutputStream(&m_outputStream);
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "ooops, transport layer unable to create an output stream");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "ooops, transport layer unable to create an output stream");
|
||||||
|
@ -509,6 +500,8 @@ void nsImapProtocol::SetupWithUrl(nsIURL * aURL)
|
||||||
// register self as the consumer for the socket...
|
// register self as the consumer for the socket...
|
||||||
rv = m_transport->SetInputStreamConsumer((nsIStreamListener *) this);
|
rv = m_transport->SetInputStreamConsumer((nsIStreamListener *) this);
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register Imap instance as a consumer on the socket");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register Imap instance as a consumer on the socket");
|
||||||
|
} // if m_runningUrl
|
||||||
|
} // if aUR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -806,7 +799,6 @@ void nsImapProtocol::ProcessCurrentURL()
|
||||||
if (GetServerStateParser().LastCommandSuccessful())
|
if (GetServerStateParser().LastCommandSuccessful())
|
||||||
SetCurrentEntryStatus(0);
|
SetCurrentEntryStatus(0);
|
||||||
#endif
|
#endif
|
||||||
SetConnectionStatus(-1); // stop netlib
|
|
||||||
if (DeathSignalReceived())
|
if (DeathSignalReceived())
|
||||||
HandleCurrentUrlError();
|
HandleCurrentUrlError();
|
||||||
}
|
}
|
||||||
|
@ -950,9 +942,7 @@ nsresult nsImapProtocol::LoadUrl(nsIURL * aURL, nsISupports * aConsumer)
|
||||||
if (aConsumer)
|
if (aConsumer)
|
||||||
rv = aConsumer->QueryInterface(kIWebShell, (void **) &m_displayConsumer);
|
rv = aConsumer->QueryInterface(kIWebShell, (void **) &m_displayConsumer);
|
||||||
|
|
||||||
if (m_transport == nsnull) // i.e. we haven't been initialized yet....
|
|
||||||
SetupWithUrl(aURL);
|
SetupWithUrl(aURL);
|
||||||
|
|
||||||
SetupSinkProxy(); // generate proxies for all of the event sinks in the url
|
SetupSinkProxy(); // generate proxies for all of the event sinks in the url
|
||||||
|
|
||||||
if (m_transport && m_runningUrl)
|
if (m_transport && m_runningUrl)
|
||||||
|
@ -964,29 +954,6 @@ nsresult nsImapProtocol::LoadUrl(nsIURL * aURL, nsISupports * aConsumer)
|
||||||
// m_urlInProgress = PR_TRUE;
|
// m_urlInProgress = PR_TRUE;
|
||||||
rv = m_transport->Open(m_runningUrl); // opening the url will cause to get notified when the connection is established
|
rv = m_transport->Open(m_runningUrl); // opening the url will cause to get notified when the connection is established
|
||||||
}
|
}
|
||||||
else // the connection is already open so we should signal the monitor that a new url is ready to be processed.
|
|
||||||
{
|
|
||||||
// mscott: the following code segment is just a hack to test imap commands from the test
|
|
||||||
// harnesss. It should eventually be replaced by the code in the else clause which just signals
|
|
||||||
// the monitor for processing the url
|
|
||||||
// ********** jefft ********* okay let's use ? search string
|
|
||||||
// for passing the raw command now.
|
|
||||||
m_urlInProgress = PR_TRUE;
|
|
||||||
const char *search = nsnull;
|
|
||||||
aURL->GetSearch(&search);
|
|
||||||
char *tmpBuffer = nsnull;
|
|
||||||
if (search && PL_strlen(search))
|
|
||||||
{
|
|
||||||
IncrementCommandTagNumber();
|
|
||||||
tmpBuffer = PR_smprintf("%s %s\r\n", GetServerCommandTag(), search);
|
|
||||||
if (tmpBuffer)
|
|
||||||
{
|
|
||||||
SendData(tmpBuffer);
|
|
||||||
PR_Free(tmpBuffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // if the connection was already open
|
|
||||||
|
|
||||||
// We now have a url to run so signal the monitor for url ready to be processed...
|
// We now have a url to run so signal the monitor for url ready to be processed...
|
||||||
PR_EnterMonitor(m_urlReadyToRunMonitor);
|
PR_EnterMonitor(m_urlReadyToRunMonitor);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче