Index: net/spdy/spdy_session.cc |
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc |
index cc190ec841f793a9d8a2aa824aa18df2b6c1a1a5..81cc5f69adf7f9247e07361255c49ed8727eba7d 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,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 it only returned when |this| is destroyed |
mmenke
2012/03/19 19:29:28
nit: it->is
Ryan Hamilton
2012/03/19 22:34:27
Done.
|
+ // we should only return true if RemoveFromPool() removed the last ref. |
+ return ret; |
+ } |
+ return false; |
+} |
+ |
void SpdySession::ActivateStream(SpdyStream* stream) { |
const spdy::SpdyStreamId id = stream->stream_id(); |
DCHECK(!IsStreamActive(id)); |