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

Unified Diff: net/spdy/spdy_session.cc

Issue 9861032: Close idle connections / SPDY sessions when needed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address eroman's comments. 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
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 412294af7a1b02b258b0eb73a7fa6aaa88b298dd..63e6744e49287c142ee41c220352fb1563486ae3 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -421,6 +421,7 @@ net::Error SpdySession::InitializeWithSocket(
state_ = CONNECTED;
connection_.reset(connection);
+ connection_->AddLayeredPool(this);
is_secure_ = is_secure;
certificate_error_code_ = certificate_error_code;
@@ -1218,6 +1219,18 @@ int SpdySession::GetLocalAddress(IPEndPoint* address) const {
return connection_->socket()->GetLocalAddress(address);
}
+bool SpdySession::CloseOneIdleConnection() {
+ if (spdy_session_pool_ && num_active_streams() == 0) {
+ bool ret = HasOneRef();
+ // Will remove a reference to this.
+ RemoveFromPool();
+ // Since the underlying socket is only returned when |this| is destroyed
+ // we should only return true if RemoveFromPool() removed the last ref.
+ return ret;
+ }
+ return false;
+}
+
void SpdySession::ActivateStream(SpdyStream* stream) {
const SpdyStreamId id = stream->stream_id();
DCHECK(!IsStreamActive(id));

Powered by Google App Engine
This is Rietveld 408576698