Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Unified Diff: net/spdy/spdy_session_pool.cc

Issue 200723004: Fix SPDY error-handling if the connection gets closed just after use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_session_pool.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session_pool.cc
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 093db1eb9e574812bd773829397e89e8a748a4e6..6ce0a937b3117503f705ed5dbf43fd073c1bcb7f 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -77,12 +77,11 @@ SpdySessionPool::~SpdySessionPool() {
CertDatabase::GetInstance()->RemoveObserver(this);
}
-net::Error SpdySessionPool::CreateAvailableSessionFromSocket(
+base::WeakPtr<SpdySession> 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);
@@ -105,22 +104,16 @@ net::Error SpdySessionPool::CreateAvailableSessionFromSocket(
trusted_spdy_proxy_,
net_log.net_log()));
- Error error = new_session->InitializeWithSocket(
+ new_session->InitializeWithSocket(
connection.Pass(), this, is_secure, certificate_error_code);
- DCHECK_NE(error, ERR_IO_PENDING);
- if (error != OK) {
- available_session->reset();
- return error;
- }
-
- *available_session = new_session->GetWeakPtr();
+ base::WeakPtr<SpdySession> 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
@@ -129,11 +122,11 @@ net::Error 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 error;
+ return available_session;
}
base::WeakPtr<SpdySession> SpdySessionPool::FindAvailableSession(
« no previous file with comments | « net/spdy/spdy_session_pool.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698