summaryrefslogtreecommitdiffstats
path: root/net/socket_stream
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 04:48:01 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 04:48:01 +0000
commit3701eb650011bdcca54578b2b755f1da94f21132 (patch)
tree0411d67d4f68baff002e449508e989b8ed4a297c /net/socket_stream
parent8f7796da5eaea7e88c8d5d3d9bd2862c18afadec (diff)
downloadchromium_src-3701eb650011bdcca54578b2b755f1da94f21132.zip
chromium_src-3701eb650011bdcca54578b2b755f1da94f21132.tar.gz
chromium_src-3701eb650011bdcca54578b2b755f1da94f21132.tar.bz2
Close immediately if no context is set
Profile::GetDefaultRequestContext() is initialized lazily, on the UI thread. So, if SocketStreamHost runs before it has gotten lazily initialized yet, SocketStream won't have context. In this case, SocketStream will die. Rather than that, just close immediately. BUG=none TEST=none Review URL: http://codereview.chromium.org/384077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket_stream')
-rw-r--r--net/socket_stream/socket_stream.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index 6a5285c..7227fe9 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -112,7 +112,8 @@ void SocketStream::Connect() {
"The current MessageLoop must exist";
DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) <<
"The current MessageLoop must be TYPE_IO";
- ssl_config_service()->GetSSLConfig(&ssl_config_);
+ if (context_)
+ ssl_config_service()->GetSSLConfig(&ssl_config_);
DCHECK_EQ(next_state_, STATE_NONE);
AddRef(); // Released in Finish()
@@ -327,6 +328,10 @@ void SocketStream::OnWriteCompleted(int result) {
}
void SocketStream::DoLoop(int result) {
+ // If context was not set, close immediately.
+ if (!context_)
+ next_state_ = STATE_CLOSE;
+
if (next_state_ == STATE_NONE)
return;