summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_session_pool.cc
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 06:35:54 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-14 06:35:54 +0000
commit6cbfa853c0ae1eded9d08972edd98ed72b25442f (patch)
tree993b90b5b91db5a3a3b8f2babb4c5a0416c9e6bc /net/spdy/spdy_session_pool.cc
parent004432da901260a8b2a4993b6de8bab4f9b825b4 (diff)
downloadchromium_src-6cbfa853c0ae1eded9d08972edd98ed72b25442f.zip
chromium_src-6cbfa853c0ae1eded9d08972edd98ed72b25442f.tar.gz
chromium_src-6cbfa853c0ae1eded9d08972edd98ed72b25442f.tar.bz2
Change SpdySessionPool to explicitly associate IP pooled sessions with the matching hostnames.
BUG=106225 TEST=SpdySessionSpdy\*Test.IPPooling\* Review URL: http://codereview.chromium.org/9621011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126594 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_session_pool.cc')
-rw-r--r--net/spdy/spdy_session_pool.cc30
1 files changed, 24 insertions, 6 deletions
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index abd5443..4b86f4b9 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -91,6 +91,10 @@ scoped_refptr<SpdySession> SpdySessionPool::GetInternal(
NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION_FROM_IP_POOL,
make_scoped_refptr(new NetLogSourceParameter(
"session", spdy_session->net_log().source())));
+ // Add this session to the map so that we can find it next time.
+ list = AddSessionList(host_port_proxy_pair);
+ list->push_back(spdy_session);
+ spdy_session->AddPooledAlias(host_port_proxy_pair);
return spdy_session;
} else if (only_use_existing_sessions) {
return NULL;
@@ -183,17 +187,31 @@ bool SpdySessionPool::HasSession(
}
void SpdySessionPool::Remove(const scoped_refptr<SpdySession>& session) {
- SpdySessionList* list = GetSessionList(session->host_port_proxy_pair());
- DCHECK(list); // We really shouldn't remove if we've already been removed.
- if (!list)
- return;
- list->remove(session);
+ bool ok = RemoveFromSessionList(session, session->host_port_proxy_pair());
+ DCHECK(ok);
session->net_log().AddEvent(
NetLog::TYPE_SPDY_SESSION_POOL_REMOVE_SESSION,
make_scoped_refptr(new NetLogSourceParameter(
"session", session->net_log().source())));
+
+ const std::set<HostPortProxyPair>& aliases = session->pooled_aliases();
+ for (std::set<HostPortProxyPair>::const_iterator it = aliases.begin();
+ it != aliases.end(); ++it) {
+ ok = RemoveFromSessionList(session, *it);
+ DCHECK(ok);
+ }
+}
+
+bool SpdySessionPool::RemoveFromSessionList(
+ const scoped_refptr<SpdySession>& session,
+ const HostPortProxyPair& pair) {
+ SpdySessionList* list = GetSessionList(pair);
+ if (!list)
+ return false;
+ list->remove(session);
if (list->empty())
- RemoveSessionList(session->host_port_proxy_pair());
+ RemoveSessionList(pair);
+ return true;
}
Value* SpdySessionPool::SpdySessionPoolInfoToValue() const {