summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_session.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/spdy/spdy_session.cc')
-rw-r--r--net/spdy/spdy_session.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 6455167..686f4ae 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -336,6 +336,7 @@ net::Error SpdySession::InitializeWithSocket(
state_ = CONNECTED;
connection_.reset(connection);
+ connection_->AddLayeredPool(this);
is_secure_ = is_secure;
certificate_error_code_ = certificate_error_code;
@@ -984,6 +985,15 @@ int SpdySession::GetLocalAddress(IPEndPoint* address) const {
return connection_->socket()->GetLocalAddress(address);
}
+bool SpdySession::CloseOneIdleConnection() {
+ if (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));
@@ -1018,12 +1028,18 @@ 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() {
if (spdy_session_pool_) {
- spdy_session_pool_->Remove(make_scoped_refptr(this));
+ SpdySessionPool* pool = spdy_session_pool_;
spdy_session_pool_ = NULL;
+ pool->Remove(make_scoped_refptr(this));
}
}