Index: net/spdy/spdy_session.cc |
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc |
index 9a8063b233bf6c657a399f10a0756835886592c3..de33fc8cb4ff6a53320c4d5e55825406e91ed775 100644 |
--- a/net/spdy/spdy_session.cc |
+++ b/net/spdy/spdy_session.cc |
@@ -378,6 +378,7 @@ net::Error SpdySession::InitializeWithSocket( |
state_ = CONNECTED; |
connection_.reset(connection); |
+ connection_->AddLayeredPool(this); |
is_secure_ = is_secure; |
certificate_error_code_ = certificate_error_code; |
@@ -1158,6 +1159,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)); |
@@ -1192,6 +1202,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()) { |
+ // Should delete this. |
+ RemoveFromPool(); |
+ } |
} |
void SpdySession::RemoveFromPool() { |