Index: net/spdy/spdy_session.cc |
=================================================================== |
--- net/spdy/spdy_session.cc (revision 218288) |
+++ 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; |
@@ -1050,7 +1050,20 @@ |
if (owned_stream->type() == SPDY_PUSH_STREAM) |
unclaimed_pushed_streams_.erase(owned_stream->url()); |
akalin
2013/08/21 17:29:03
can you fix this indent while you're here?
mmenke
2013/08/21 18:17:16
Done.
|
+ // If there are no active streams, and the socket pool is stalled, try to free |
+ // up a socket slot. This must be done before the call to DeleteStream, as it |
+ // may delete the session. |
+ if (active_streams_.empty() && availability_state_ == STATE_AVAILABLE && |
akalin
2013/08/21 17:29:03
i think this should go after DeleteStream, as othe
mmenke
2013/08/21 18:17:16
Done.
|
+ connection_->IsPoolStalled()) { |
+ // Can't close the session synchronously, because callers don't expect it. |
+ base::MessageLoop::current()->PostTask( |
akalin
2013/08/21 17:29:03
you should be able to just call CloseIfIdle here d
mmenke
2013/08/21 18:17:16
Done.
When I wrote this CL a month ago, that resu
|
+ FROM_HERE, base::Bind(&SpdySession::CloseIfIdle, |
+ weak_factory_.GetWeakPtr())); |
+ } |
+ |
DeleteStream(owned_stream.Pass(), status); |
+ |
+ // |this| may have been deleted at this point. |
} |
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 |