summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 15:24:34 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 15:24:34 +0000
commit66992526f6c2c1fa706c0a38177119bbac25aa90 (patch)
tree9376d8ff2002cc054628005b699c1e41ed648057 /net
parenta01076ab38b57005e040da62d6dd37074c38a8cf (diff)
downloadchromium_src-66992526f6c2c1fa706c0a38177119bbac25aa90.zip
chromium_src-66992526f6c2c1fa706c0a38177119bbac25aa90.tar.gz
chromium_src-66992526f6c2c1fa706c0a38177119bbac25aa90.tar.bz2
The IP Aliases table was not being properly cleared when we manually close
all connections (which is done in the benchmark code, and also when changing networks) BUG=78811 TEST=SpdySessionPoolTest.IPPoolingCleanedOnClose Review URL: http://codereview.chromium.org/6820052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81252 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/spdy/spdy_session_pool.cc5
-rw-r--r--net/spdy/spdy_session_unittest.cc26
2 files changed, 25 insertions, 6 deletions
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index daa6e01..9d14f4e 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -392,9 +392,12 @@ void SpdySessionPool::CloseCurrentSessions() {
list->pop_front();
if (list->empty()) {
delete list;
+ RemoveAliases(old_map.begin()->first);
old_map.erase(old_map.begin()->first);
}
}
+ DCHECK(sessions_.empty());
+ DCHECK(aliases_.empty());
}
} // namespace net
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index 75f7885..cdcfb35 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -406,7 +406,11 @@ TEST_F(SpdySessionTest, SendSettingsOnNewSession) {
EXPECT_TRUE(data.at_write_eof());
}
-TEST_F(SpdySessionTest, IPPooling) {
+// This test has two variants, one for each style of closing the connection.
+// If |clean_via_close_current_sessions| is false, the sessions are closed
+// manually, calling SpdySessionPool::Remove() directly. If it is true,
+// sessions are closed with SpdySessionPool::CloseCurrentSessions().
+void IPPoolingTest(bool clean_via_close_current_sessions) {
const int kTestPort = 80;
struct TestHosts {
std::string name;
@@ -500,10 +504,14 @@ TEST_F(SpdySessionTest, IPPooling) {
EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[2].pair));
// Cleanup the sessions.
- spdy_session_pool->Remove(session);
- session = NULL;
- spdy_session_pool->Remove(session2);
- session2 = NULL;
+ if (!clean_via_close_current_sessions) {
+ spdy_session_pool->Remove(session);
+ session = NULL;
+ spdy_session_pool->Remove(session2);
+ session2 = NULL;
+ } else {
+ spdy_session_pool->CloseCurrentSessions();
+ }
// Verify that the map is all cleaned up.
EXPECT_FALSE(spdy_session_pool->HasSession(test_hosts[0].pair));
@@ -511,6 +519,14 @@ TEST_F(SpdySessionTest, IPPooling) {
EXPECT_FALSE(spdy_session_pool->HasSession(test_hosts[2].pair));
}
+TEST_F(SpdySessionTest, IPPooling) {
+ IPPoolingTest(false);
+}
+
+TEST_F(SpdySessionTest, IPPoolingCloseCurrentSessions) {
+ IPPoolingTest(true);
+}
+
} // namespace
} // namespace net