Bug 1170645. Don't try to RemoveFromQueue websocket channels that are not queued. r=jduell
☠☠ backed out by 495d000aad5e ☠ ☠
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 05 Jun 2015 12:41:36 -0400
changeset 326813 0283d11943916b865db83d22c014e397e6fc588a
parent 326812 25b7b298c3f340651cacdfb28e596076c29d22fa
child 326814 daa688d50b0904fa01157551dc21c5b16fe3ef0a
push id10169
push userdminor@mozilla.com
push dateThu, 28 Jan 2016 13:10:48 +0000
reviewersjduell
bugs1170645
milestone41.0a1
Bug 1170645. Don't try to RemoveFromQueue websocket channels that are not queued. r=jduell
netwerk/protocol/websocket/WebSocketChannel.cpp
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -421,21 +421,23 @@ public:
 
     if (aChannel->mConnecting) {
       // Only way a connecting channel may get here w/o failing is if it was
       // closed with GOING_AWAY (1001) because of navigation, tab close, etc.
       MOZ_ASSERT(NS_FAILED(aReason) ||
                  aChannel->mScriptCloseCode == CLOSE_GOING_AWAY,
                  "websocket closed while connecting w/o failing?");
 
-      sManager->RemoveFromQueue(aChannel);
-
-      bool wasNotQueued = (aChannel->mConnecting != CONNECTING_QUEUED);
+      bool wasQueued = (aChannel->mConnecting == CONNECTING_QUEUED);
+      if (wasQueued) {
+        sManager->RemoveFromQueue(aChannel);
+      }
+
       aChannel->mConnecting = NOT_CONNECTING;
-      if (wasNotQueued) {
+      if (!wasQueued) {
         sManager->ConnectNext(aChannel->mAddress);
       }
     }
   }
 
   static void IncrementSessionCount()
   {
     StaticMutexAutoLock lock(sLock);