summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 01:23:12 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 01:23:12 +0000
commit725d2e8083a3b3ddad40b120abc05bbb04707e00 (patch)
tree73c1f683554bdb75c6817f6228935b480ee1ea37
parente416b3d4729fe1174aeacce696052073690df86c (diff)
downloadchromium_src-725d2e8083a3b3ddad40b120abc05bbb04707e00.zip
chromium_src-725d2e8083a3b3ddad40b120abc05bbb04707e00.tar.gz
chromium_src-725d2e8083a3b3ddad40b120abc05bbb04707e00.tar.bz2
Fix flaky WebSocket crash with url-with-credential.html
url-with-credential.html sometimes crash: [15193:15197:8597261003639:FATAL:net/socket_stream/socket_stream.cc(393)] Check failed: OK == result (0 vs. -3) Backtrace: StackTrace::StackTrace() [0x81a3fca] logging::LogMessage::~LogMessage() [0x814f89f] net::SocketStream::DoLoop() [0x93ca7f1] net::SocketStream::DoClose() [0x93cb171] This happens if the SocketStream is closed while waiting in STATE_TCP_CONNECT. If state is STATE_TCP_CONNECT and result is not OK, it's ok to close. BUG=50394 TEST=url-with-credential.html doesn't crash Review URL: http://codereview.chromium.org/3154003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55648 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/socket_stream/socket_stream.cc12
-rw-r--r--net/socket_stream/socket_stream.h2
2 files changed, 9 insertions, 5 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index 448ebbb..8d7bfae 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -390,8 +390,7 @@ void SocketStream::DoLoop(int result) {
result = DoResolveHostComplete(result);
break;
case STATE_TCP_CONNECT:
- DCHECK_EQ(OK, result);
- result = DoTcpConnect();
+ result = DoTcpConnect(result);
break;
case STATE_TCP_CONNECT_COMPLETE:
result = DoTcpConnectComplete(result);
@@ -428,7 +427,8 @@ void SocketStream::DoLoop(int result) {
result = DoReadWrite(result);
break;
case STATE_AUTH_REQUIRED:
- NOTREACHED() << "Should not run DoLoop in STATE_AUTH_REQUIRED state.";
+ // It might be called when DoClose is called while waiting in
+ // STATE_AUTH_REQUIRED.
Finish(result);
return;
case STATE_CLOSE:
@@ -541,7 +541,11 @@ int SocketStream::DoResolveHostComplete(int result) {
return result;
}
-int SocketStream::DoTcpConnect() {
+int SocketStream::DoTcpConnect(int result) {
+ if (result != OK) {
+ next_state_ = STATE_CLOSE;
+ return result;
+ }
next_state_ = STATE_TCP_CONNECT_COMPLETE;
DCHECK(factory_);
socket_.reset(factory_->CreateTCPClientSocket(addresses_,
diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h
index ec97276..87237f1 100644
--- a/net/socket_stream/socket_stream.h
+++ b/net/socket_stream/socket_stream.h
@@ -241,7 +241,7 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
int DoResolveProxyComplete(int result);
int DoResolveHost();
int DoResolveHostComplete(int result);
- int DoTcpConnect();
+ int DoTcpConnect(int result);
int DoTcpConnectComplete(int result);
int DoWriteTunnelHeaders();
int DoWriteTunnelHeadersComplete(int result);