Bug 983243 - WSS WebSocket leaks TCP/IP connection if closed prematurely r=mcmanus
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 04 Jun 2014 02:15:14 +0300
changeset 206770 dbbd754c9a24f6cbbeb4f5d6121a9f519965c68e
parent 206769 58541e1f52d2bdd817fe759a7403947de33227cf
child 206771 1307202f365c318e9e7065b19a33f915717478a6
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs983243
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 983243 - WSS WebSocket leaks TCP/IP connection if closed prematurely r=mcmanus Prevent WebSocketChannel::OnTransportAvailable from reinitializing the channel's references after it has been closed.
netwerk/protocol/websocket/WebSocketChannel.cpp
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -2937,16 +2937,21 @@ WebSocketChannel::OnTransportAvailable(n
                                                                 aTransport,
                                                                 aSocketIn,
                                                                 aSocketOut));
   }
 
   LOG(("WebSocketChannel::OnTransportAvailable %p [%p %p %p] rcvdonstart=%d\n",
        this, aTransport, aSocketIn, aSocketOut, mGotUpgradeOK));
 
+  if (mStopped) {
+    LOG(("WebSocketChannel::OnTransportAvailable: Already stopped"));
+    return NS_OK;
+  }
+
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread");
   NS_ABORT_IF_FALSE(!mRecvdHttpUpgradeTransport, "OTA duplicated");
   NS_ABORT_IF_FALSE(aSocketIn, "OTA with invalid socketIn");
 
   mTransport = aTransport;
   mSocketIn = aSocketIn;
   mSocketOut = aSocketOut;