diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-28 23:55:46 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-28 23:55:46 +0000 |
commit | e3ceb68c8b7176d838a071abdb028a652fa9570d (patch) | |
tree | 72b7ce9d23670aaac5c3cd449618712768d0595d /net/spdy/spdy_session_pool.cc | |
parent | 37ebcd63f367449cadde58365bc840aec9ae1a9e (diff) | |
download | chromium_src-e3ceb68c8b7176d838a071abdb028a652fa9570d.zip chromium_src-e3ceb68c8b7176d838a071abdb028a652fa9570d.tar.gz chromium_src-e3ceb68c8b7176d838a071abdb028a652fa9570d.tar.bz2 |
Speculative fix for bug 80095.
Based off previous CHECKs added, it appears that SpdySessionPool::HasSession() may return true, but later on, may return false. I hypothesize that this is because of HostCache entries expiring in between calls to HasSession().
The solution is not to use HasSession(), but instead just call a new SpdySessionPool::GetIfExists() function. If we acquire it, then cache it in a member variable of HttpStreamFactoryImpl::Job.
BUG=80095
TEST=New tests in HttpNetworkTransactionTest. Because it's timing related, it's hard to come up with a solid repro case.
Review URL: http://codereview.chromium.org/7260014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_session_pool.cc')
-rw-r--r-- | net/spdy/spdy_session_pool.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index da2d331..adaeabf 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -61,6 +61,19 @@ SpdySessionPool::~SpdySessionPool() { scoped_refptr<SpdySession> SpdySessionPool::Get( const HostPortProxyPair& host_port_proxy_pair, const BoundNetLog& net_log) { + return GetInternal(host_port_proxy_pair, net_log, false); +} + +scoped_refptr<SpdySession> SpdySessionPool::GetIfExists( + const HostPortProxyPair& host_port_proxy_pair, + const BoundNetLog& net_log) { + return GetInternal(host_port_proxy_pair, net_log, true); +} + +scoped_refptr<SpdySession> SpdySessionPool::GetInternal( + const HostPortProxyPair& host_port_proxy_pair, + const BoundNetLog& net_log, + bool only_use_existing_sessions) { scoped_refptr<SpdySession> spdy_session; SpdySessionList* list = GetSessionList(host_port_proxy_pair); if (!list) { @@ -75,6 +88,8 @@ scoped_refptr<SpdySession> SpdySessionPool::Get( make_scoped_refptr(new NetLogSourceParameter( "session", spdy_session->net_log().source()))); return spdy_session; + } else if (only_use_existing_sessions) { + return NULL; } list = AddSessionList(host_port_proxy_pair); } @@ -92,6 +107,8 @@ scoped_refptr<SpdySession> SpdySessionPool::Get( return spdy_session; } + DCHECK(!only_use_existing_sessions); + spdy_session = new SpdySession(host_port_proxy_pair, this, &spdy_settings_, net_log.net_log()); UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionGet", |