Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: net/spdy/spdy_session.cc

Issue 18796003: When an idle socket is added back to a socket pool, check for stalled jobs in lower pools (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Response to comments Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698