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

Unified Diff: net/spdy/spdy_session.cc

Issue 9667016: Close idle connections / SPDY sessions when needed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 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
« net/socket/client_socket_pool_base.cc ('K') | « net/spdy/spdy_session.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index cc190ec841f793a9d8a2aa824aa18df2b6c1a1a5..5572566e259bced4606282e85b9bccf4fd916e10 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -379,6 +379,7 @@ net::Error SpdySession::InitializeWithSocket(
state_ = CONNECTED;
connection_.reset(connection);
+ connection_->AddLayeredPool(this);
is_secure_ = is_secure;
certificate_error_code_ = certificate_error_code;
@@ -1176,6 +1177,15 @@ int SpdySession::GetLocalAddress(IPEndPoint* address) const {
return connection_->socket()->GetLocalAddress(address);
}
+bool SpdySession::CloseOneIdleConnection() {
+ if (spdy_session_pool_ && num_active_streams() == 0) {
+ // Should delete this.
+ RemoveFromPool();
+ return true;
+ }
+ return false;
+}
+
void SpdySession::ActivateStream(SpdyStream* stream) {
const spdy::SpdyStreamId id = stream->stream_id();
DCHECK(!IsStreamActive(id));
@@ -1210,6 +1220,11 @@ void SpdySession::DeleteStream(spdy::SpdyStreamId id, int status) {
if (stream)
stream->OnClose(status);
ProcessPendingCreateStreams();
+ if (num_active_streams() == 0 && connection_->is_initialized() &&
+ connection_->IsPoolStalled()) {
mmenke 2012/03/16 18:01:15 Think we should have a test for this, or even land
Ryan Hamilton 2012/03/16 22:21:03 Removed for now.
+ // Should delete this.
+ RemoveFromPool();
+ }
}
void SpdySession::RemoveFromPool() {
« net/socket/client_socket_pool_base.cc ('K') | « net/spdy/spdy_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698