Chromium Code Reviews| Index: net/spdy/spdy_session.cc |
| diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc |
| index bc8a100379d309e2776202fd42640c9e01552da0..cf1ccd76e76b6ab6549f098fe5eabff31b9b2644 100644 |
| --- a/net/spdy/spdy_session.cc |
| +++ b/net/spdy/spdy_session.cc |
| @@ -331,6 +331,7 @@ net::Error SpdySession::InitializeWithSocket( |
| state_ = CONNECTED; |
| connection_.reset(connection); |
| + connection_->AddLayeredPool(this); |
| is_secure_ = is_secure; |
| certificate_error_code_ = certificate_error_code; |
| @@ -967,6 +968,15 @@ int SpdySession::GetLocalAddress(IPEndPoint* address) const { |
| return connection_->socket()->GetLocalAddress(address); |
| } |
| +bool SpdySession::CloseOneIdleConnection() { |
| + if (num_active_streams() == 0) { |
| + // Should delete this. |
| + RemoveFromPool(); |
|
mmenke
2011/10/27 18:52:37
Is this safe? It looks to me like there may be no
willchan no longer on Chromium
2011/11/08 22:26:13
I'm not sure I understand the worry. When we call
mmenke
2011/11/08 22:41:04
We don't dereference |this|, but RemoveFromPool do
willchan no longer on Chromium
2011/11/15 18:44:06
Again, great catch. I've fixed this.
|
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| void SpdySession::ActivateStream(SpdyStream* stream) { |
| const spdy::SpdyStreamId id = stream->stream_id(); |
| DCHECK(!IsStreamActive(id)); |
| @@ -1001,6 +1011,10 @@ void SpdySession::DeleteStream(spdy::SpdyStreamId id, int status) { |
| if (stream) |
| stream->OnClose(status); |
| ProcessPendingCreateStreams(); |
| + if (num_active_streams() == 0 && connection_->IsPoolStalled()) { |
| + // Should delete this. |
| + RemoveFromPool(); |
| + } |
| } |
| void SpdySession::RemoveFromPool() { |