diff --git a/netwerk/base/nsSocketTransport2.cpp b/netwerk/base/nsSocketTransport2.cpp index 2d00bdd9d65b..601d62aa9a40 100644 --- a/netwerk/base/nsSocketTransport2.cpp +++ b/netwerk/base/nsSocketTransport2.cpp @@ -1886,7 +1886,9 @@ nsSocketTransport::OnSocketReady(PRFileDesc *fd, int16_t outFlags) // Update poll timeout in case it was changed mPollTimeout = mTimeouts[TIMEOUT_READ_WRITE]; } - else if (mState == STATE_CONNECTING) { + else if ((mState == STATE_CONNECTING) && !gIOService->IsNetTearingDown()) { + // We do not need to do PR_ConnectContinue when we are already + // shutting down. // We use PRIntervalTime here because we need // nsIOService::LastOfflineStateChange time and @@ -1959,6 +1961,13 @@ nsSocketTransport::OnSocketReady(PRFileDesc *fd, int16_t outFlags) } } } + else if ((mState == STATE_CONNECTING) && gIOService->IsNetTearingDown()) { + // We do not need to do PR_ConnectContinue when we are already + // shutting down. + SOCKET_LOG(("We are in shutdown so skip PR_ConnectContinue and set " + "and error.\n")); + mCondition = NS_ERROR_ABORT; + } else { NS_ERROR("unexpected socket state"); mCondition = NS_ERROR_UNEXPECTED;