Chromium Code Reviews| Index: net/spdy/spdy_session.cc |
| =================================================================== |
| --- net/spdy/spdy_session.cc (revision 218769) |
| +++ net/spdy/spdy_session.cc (working copy) |
| @@ -517,7 +517,7 @@ |
| error = OK; |
| if (error == OK) { |
| DCHECK_NE(availability_state_, STATE_CLOSED); |
| - connection_->AddLayeredPool(this); |
| + connection_->AddHigherLayeredPool(this); |
| if (enable_sending_initial_data_) |
| SendInitialData(); |
| pool_ = pool; |
| @@ -1048,9 +1048,22 @@ |
| // push is hardly used. Write tests for this and fix this. (See |
| // http://crbug.com/261712 .) |
| if (owned_stream->type() == SPDY_PUSH_STREAM) |
| - unclaimed_pushed_streams_.erase(owned_stream->url()); |
| + unclaimed_pushed_streams_.erase(owned_stream->url()); |
| + base::WeakPtr<SpdySession> weak_this = GetWeakPtr(); |
| + |
| DeleteStream(owned_stream.Pass(), status); |
| + |
| + if (!weak_this) |
| + return; |
| + |
| + if (availability_state_ == STATE_CLOSED) |
| + return; |
| + |
| + // If there are no active streams, and the socket pool is stalled, try to free |
|
akalin
2013/08/21 21:01:18
I think the comment could be a bit clearer:
// If
mmenke
2013/08/21 21:10:08
Done.
|
| + // up a socket slot. |
| + if (active_streams_.empty() && connection_->IsPoolStalled()) |
| + CloseIfIdle(); |
|
akalin
2013/08/21 21:01:18
can you remove CloseIfIdle and just inline the cod
mmenke
2013/08/21 21:10:08
Done. I also got rid of the check that pool_ is n
|
| } |
| void SpdySession::CloseCreatedStreamIterator(CreatedStreamSet::iterator it, |
| @@ -2925,4 +2938,11 @@ |
| return 0; |
| } |
| +void SpdySession::CloseIfIdle() { |
| + // If the session isn't idle, or it has already been closed, do nothing. |
| + if (!active_streams_.empty() || availability_state_ == STATE_CLOSED || !pool_) |
| + return; |
| + DoCloseSession(ERR_CONNECTION_CLOSED, "Closing idle connection."); |
| +} |
| + |
| } // namespace net |