зеркало из https://github.com/mozilla/gecko-dev.git
we need to call Cancel() to remove the closed nsSocketTransport from the list of active transports. if we don't, we quickly reach the max (50) and pop, smtp, and nntp operation start failing. also, upon NS_BINDING_ABORTED, do not pop up an alert. we get this when we call Cancel() or if the user hits the stop button.
This commit is contained in:
Родитель
299e2bdb1c
Коммит
0487a8b1a3
|
@ -140,12 +140,19 @@ nsresult nsMsgProtocol::SetupTransportState()
|
|||
|
||||
nsresult nsMsgProtocol::CloseSocket()
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// release all of our socket state
|
||||
m_socketIsOpen = PR_FALSE;
|
||||
m_outputStream = null_nsCOMPtr();
|
||||
|
||||
// we need to call Cancel so that we remove the socket transport from the mActiveTransportList. see bug #30648
|
||||
if (m_channel) {
|
||||
rv = m_channel->Cancel();
|
||||
}
|
||||
m_channel = null_nsCOMPtr();
|
||||
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -218,8 +225,12 @@ NS_IMETHODIMP nsMsgProtocol::OnStopRequest(nsIChannel * aChannel, nsISupports *c
|
|||
// happens to be using
|
||||
if (m_channelListener)
|
||||
rv = m_channelListener->OnStopRequest(this, m_channelContext, aStatus, aMsg);
|
||||
|
||||
if (NS_FAILED(aStatus)) {
|
||||
|
||||
// !NS_BINDING_ABORTED because we don't want to see an alert if the user
|
||||
// cancelled the operation. also, we'll get here because we call Cancel()
|
||||
// to force removal of the nsSocketTransport. see CloseSocket()
|
||||
// bugs #30775 and #30648 relate to this
|
||||
if (NS_FAILED(aStatus) && (aStatus != NS_BINDING_ABORTED)) {
|
||||
NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && dialog) {
|
||||
// todo, put this into a string bundle
|
||||
|
|
|
@ -226,6 +226,7 @@ nsresult nsSocketTransportService::ProcessWorkQ(void)
|
|||
// available in the select set...
|
||||
//
|
||||
PR_Lock(mThreadLock);
|
||||
NS_ASSERTION(MAX_OPEN_CONNECTIONS > mSelectFDSetCount, "reached max open connections");
|
||||
while (!PR_CLIST_IS_EMPTY(&mWorkQ) &&
|
||||
(MAX_OPEN_CONNECTIONS > mSelectFDSetCount)) {
|
||||
nsSocketTransport* transport;
|
||||
|
@ -270,6 +271,7 @@ nsresult nsSocketTransportService::AddToSelectList(nsSocketTransport* aTransport
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ASSERTION(MAX_OPEN_CONNECTIONS > mSelectFDSetCount, "reached max open connections");
|
||||
if (aTransport && (MAX_OPEN_CONNECTIONS > mSelectFDSetCount) ) {
|
||||
PRPollDesc* pfd;
|
||||
int i;
|
||||
|
@ -338,6 +340,9 @@ nsresult nsSocketTransportService::RemoveFromSelectList(nsSocketTransport* aTran
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("mSelectFDSetCount = %d\n",mSelectFDSetCount);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче