Bug 1152046 - Don't try to connect if we are shutting down. r=mayhemer, a=sledru
authorDragana Damjanovic <dd.mozilla@gmail.com>
Fri, 29 May 2015 02:04:00 -0400
changeset 275208 6b9bf28f9b8ae738865c92688eae3004d57e3efd
parent 275207 d2826245bf84a2782ea3d318716724021b85ef08
child 275209 79f7def984405cb6dffd31dbb2b481943d18f15f
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, sledru
bugs1152046
milestone40.0a2
Bug 1152046 - Don't try to connect if we are shutting down. r=mayhemer, a=sledru
netwerk/base/nsIOService.h
netwerk/base/nsSocketTransport2.cpp
--- a/netwerk/base/nsIOService.h
+++ b/netwerk/base/nsIOService.h
@@ -73,16 +73,17 @@ public:
 
     // Called by channels before a redirect happens. This notifies the global
     // redirect observers.
     nsresult AsyncOnChannelRedirect(nsIChannel* oldChan, nsIChannel* newChan,
                                     uint32_t flags,
                                     nsAsyncRedirectVerifyHelper *helper);
 
     bool IsOffline() { return mOffline; }
+    bool IsShutdown() { return mShutdown; }
     bool IsLinkUp();
 
     // Should only be called from NeckoChild. Use SetAppOffline instead.
     void SetAppOfflineInternal(uint32_t appId, int32_t status);
 
 private:
     // These shouldn't be called directly:
     // - construct using GetInstance
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -1212,16 +1212,19 @@ nsSocketTransport::InitiateSocket()
             crashOnNonLocalConnections = 0;
         }
     }
 
     nsresult rv;
     bool isLocal;
     IsLocal(&isLocal);
 
+    if (gIOService->IsShutdown()) {
+        return NS_ERROR_ABORT;
+    }
     if (gIOService->IsOffline()) {
         if (!isLocal)
             return NS_ERROR_OFFLINE;
     } else if (!isLocal) {
 
 #ifdef DEBUG
         // all IP networking has to be done from the parent
         if (NS_SUCCEEDED(mCondition) &&