summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-09-08 22:40:01 +0100
committerKristian Monsen <kristianm@google.com>2011-09-08 22:43:33 +0100
commit93a4a82bca0155ddfbec36777ade7d6dad6bfb61 (patch)
treeb4eb9c16656aae25f21987e36c8d180636622b63 /net
parentd8b3e76734b4fcc2d678351d180be3ae786716a7 (diff)
downloadexternal_chromium-93a4a82bca0155ddfbec36777ade7d6dad6bfb61.zip
external_chromium-93a4a82bca0155ddfbec36777ade7d6dad6bfb61.tar.gz
external_chromium-93a4a82bca0155ddfbec36777ade7d6dad6bfb61.tar.bz2
Fix for bug 4487538 Current Drain
Closing idle connections when timers are paused. Cherry-picking from: http://codereview.chromium.org/7380004/ Change-Id: Ief5de0ec6665c6cd27f3bb2639297675f44fa28d
Diffstat (limited to 'net')
-rw-r--r--net/http/http_network_session.h1
-rw-r--r--net/spdy/spdy_session.h5
-rw-r--r--net/spdy/spdy_session_pool.cc16
-rw-r--r--net/spdy/spdy_session_pool.h2
4 files changed, 24 insertions, 0 deletions
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h
index 14b85ae..3d46014 100644
--- a/net/http/http_network_session.h
+++ b/net/http/http_network_session.h
@@ -146,6 +146,7 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>,
void CloseIdleConnections() {
socket_pool_manager_.CloseIdleSockets();
+ spdy_session_pool_.CloseIdleSessions();
}
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 46d1903..ed00e4f 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -189,6 +189,11 @@ class SpdySession : public base::RefCounted<SpdySession>,
spdy_session_pool_ = NULL;
}
+ // Returns true if session is not currently active
+ bool is_active() const {
+ return !active_streams_.empty();
+ }
+
// Access to the number of active and pending streams. These are primarily
// available for testing and diagnostics.
size_t num_active_streams() const { return active_streams_.size(); }
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 9e49d45..9b44b94 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -408,4 +408,20 @@ void SpdySessionPool::CloseCurrentSessions() {
DCHECK(aliases_.empty());
}
+void SpdySessionPool::CloseIdleSessions() {
+ SpdySessionsMap::const_iterator map_it = sessions_.begin();
+ while (map_it != sessions_.end()) {
+ SpdySessionList* list = map_it->second;
+ ++map_it;
+ CHECK(list);
+
+ // Assumes there is only 1 element in the list
+ SpdySessionList::iterator session_it = list->begin();
+ const scoped_refptr<SpdySession>& session = *session_it;
+ CHECK(session);
+ if (!session->is_active())
+ session->CloseSessionOnError(net::ERR_ABORTED, true);
+ }
+}
+
} // namespace net
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 32531d5..f4b87b6 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -83,6 +83,8 @@ class SpdySessionPool
// Close only the currently existing SpdySessions. Let any new ones created
// continue to live.
void CloseCurrentSessions();
+ // Close only the idle SpdySessions.
+ void CloseIdleSessions();
// Removes a SpdySession from the SpdySessionPool. This should only be called
// by SpdySession, because otherwise session->state_ is not set to CLOSED.