summaryrefslogtreecommitdiffstats
path: root/net/websockets/websocket_channel.cc
diff options
context:
space:
mode:
authorricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 11:24:49 +0000
committerricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-05 11:24:49 +0000
commit6dfd8b386c3e18c2db539487d1cc3f90c38a882a (patch)
treeabfa7cb5dd4f2c4584154fa31593504778a65f5e /net/websockets/websocket_channel.cc
parent3bfa277ba47662647beb93e10d58fe134e478be0 (diff)
downloadchromium_src-6dfd8b386c3e18c2db539487d1cc3f90c38a882a.zip
chromium_src-6dfd8b386c3e18c2db539487d1cc3f90c38a882a.tar.gz
chromium_src-6dfd8b386c3e18c2db539487d1cc3f90c38a882a.tar.bz2
The renderer has no way to indicate a close during connection except by
sending an OnDropChannel message. Since the code in content/ is mostly stateless, we need to handle this in WebSocketChannel. This CL changes the behaviour from ignoring the message (or crashing in Debug builds) to cancelling the connection and responding with an OnDropChannel message, freeing resources both in the browser and renderer. BUG=340602 TEST=net_unittests --gtest_filter=WebSocketChannel* Review URL: https://codereview.chromium.org/140983009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248966 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/websockets/websocket_channel.cc')
-rw-r--r--net/websockets/websocket_channel.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/websockets/websocket_channel.cc b/net/websockets/websocket_channel.cc
index 388e371..0e68168 100644
--- a/net/websockets/websocket_channel.cc
+++ b/net/websockets/websocket_channel.cc
@@ -317,6 +317,13 @@ void WebSocketChannel::StartClosingHandshake(uint16 code,
<< ". This may be a bug, or a harmless race.";
return;
}
+ if (state_ == CONNECTING) {
+ // Abort the in-progress handshake and drop the connection immediately.
+ stream_request_.reset();
+ state_ = CLOSED;
+ AllowUnused(DoDropChannel(kWebSocketErrorAbnormalClosure, ""));
+ return;
+ }
if (state_ != CONNECTED) {
NOTREACHED() << "StartClosingHandshake() called in state " << state_;
return;