diff options
Diffstat (limited to 'net/spdy/spdy_session_pool.cc')
-rw-r--r-- | net/spdy/spdy_session_pool.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index 6ce0a93..093db1e 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -77,11 +77,12 @@ SpdySessionPool::~SpdySessionPool() { 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 @@ base::WeakPtr<SpdySession> SpdySessionPool::CreateAvailableSessionFromSocket( trusted_spdy_proxy_, net_log.net_log())); - new_session->InitializeWithSocket( + Error error = new_session->InitializeWithSocket( connection.Pass(), this, is_secure, certificate_error_code); + DCHECK_NE(error, ERR_IO_PENDING); - base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); + 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 @@ base::WeakPtr<SpdySession> SpdySessionPool::CreateAvailableSessionFromSocket( // 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( |