Index: net/spdy/spdy_session_pool.cc |
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc |
index 6ce0a937b3117503f705ed5dbf43fd073c1bcb7f..093db1eb9e574812bd773829397e89e8a748a4e6 100644 |
--- a/net/spdy/spdy_session_pool.cc |
+++ b/net/spdy/spdy_session_pool.cc |
@@ -77,11 +77,12 @@ |
CertDatabase::GetInstance()->RemoveObserver(this); |
} |
-base::WeakPtr<SpdySession> SpdySessionPool::CreateAvailableSessionFromSocket( |
+net::Error SpdySessionPool::CreateAvailableSessionFromSocket( |
const SpdySessionKey& key, |
scoped_ptr<ClientSocketHandle> connection, |
const BoundNetLog& net_log, |
int certificate_error_code, |
+ base::WeakPtr<SpdySession>* available_session, |
bool is_secure) { |
DCHECK_GE(default_protocol_, kProtoSPDYMinimumVersion); |
DCHECK_LE(default_protocol_, kProtoSPDYMaximumVersion); |
@@ -104,16 +105,22 @@ |
trusted_spdy_proxy_, |
net_log.net_log())); |
- new_session->InitializeWithSocket( |
+ Error error = new_session->InitializeWithSocket( |
connection.Pass(), this, is_secure, certificate_error_code); |
- |
- base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); |
+ DCHECK_NE(error, ERR_IO_PENDING); |
+ |
+ if (error != OK) { |
+ available_session->reset(); |
+ return error; |
+ } |
+ |
+ *available_session = new_session->GetWeakPtr(); |
sessions_.insert(new_session.release()); |
- MapKeyToAvailableSession(key, available_session); |
+ MapKeyToAvailableSession(key, *available_session); |
net_log.AddEvent( |
NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
- available_session->net_log().source().ToEventParametersCallback()); |
+ (*available_session)->net_log().source().ToEventParametersCallback()); |
// Look up the IP address for this session so that we can match |
// future sessions (potentially to different domains) which can |
@@ -122,11 +129,11 @@ |
// to see if this is a direct connection. |
if (key.proxy_server().is_direct()) { |
IPEndPoint address; |
- if (available_session->GetPeerAddress(&address) == OK) |
+ if ((*available_session)->GetPeerAddress(&address) == OK) |
aliases_[address] = key; |
} |
- return available_session; |
+ return error; |
} |
base::WeakPtr<SpdySession> SpdySessionPool::FindAvailableSession( |