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

Unified Diff: net/spdy/spdy_session.cc

Issue 14232014: Correctly handle SPDY GOAWAY frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments Created 7 years, 8 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_spdy2_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
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index ba84ea12acbbe9e41dfea287860e52eda6fdbbef..b04e5fbca2f81866b8e5e0ad1488c53d600a7c10 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -1132,19 +1132,8 @@ void SpdySession::WriteSocket() {
}
}
-void SpdySession::CloseAllStreams(net::Error status) {
- base::StatsCounter abandoned_streams("spdy.abandoned_streams");
- base::StatsCounter abandoned_push_streams(
- "spdy.abandoned_push_streams");
-
- if (!active_streams_.empty())
- abandoned_streams.Add(active_streams_.size());
- if (!unclaimed_pushed_streams_.empty()) {
- streams_abandoned_count_ += unclaimed_pushed_streams_.size();
- abandoned_push_streams.Add(unclaimed_pushed_streams_.size());
- unclaimed_pushed_streams_.clear();
- }
-
+void SpdySession::CloseAllStreamsAfter(SpdyStreamId last_good_stream_id,
+ net::Error status) {
for (int i = 0; i < NUM_PRIORITIES; ++i) {
PendingStreamRequestQueue queue;
queue.swap(pending_create_stream_queues_[i]);
@@ -1154,11 +1143,14 @@ void SpdySession::CloseAllStreams(net::Error status) {
}
}
- while (!active_streams_.empty()) {
- ActiveStreamMap::iterator it = active_streams_.begin();
+ ActiveStreamMap::iterator it =
+ active_streams_.lower_bound(last_good_stream_id + 1);
+ while (it != active_streams_.end()) {
const scoped_refptr<SpdyStream>& stream = it->second;
+ ++it;
LogAbandonedStream(stream, status);
DeleteStream(stream->stream_id(), status);
+ streams_abandoned_count_++;
}
while (!created_streams_.empty()) {
@@ -1169,6 +1161,21 @@ void SpdySession::CloseAllStreams(net::Error status) {
stream->OnClose(status);
}
+ write_queue_.RemovePendingWritesForStreamsAfter(last_good_stream_id);
+}
+
+void SpdySession::CloseAllStreams(net::Error status) {
+ base::StatsCounter abandoned_streams("spdy.abandoned_streams");
+ base::StatsCounter abandoned_push_streams(
+ "spdy.abandoned_push_streams");
+
+ if (!unclaimed_pushed_streams_.empty()) {
+ streams_abandoned_count_ += unclaimed_pushed_streams_.size();
+ abandoned_push_streams.Add(unclaimed_pushed_streams_.size());
+ unclaimed_pushed_streams_.clear();
+ }
+
+ CloseAllStreamsAfter(0, status);
write_queue_.Clear();
}
@@ -1743,14 +1750,7 @@ void SpdySession::OnGoAway(SpdyStreamId last_accepted_stream_id,
unclaimed_pushed_streams_.size(),
status));
RemoveFromPool();
- CloseAllStreams(net::ERR_ABORTED);
-
- // TODO(willchan): Cancel any streams that are past the GoAway frame's
- // |last_accepted_stream_id|.
-
- // Don't bother killing any streams that are still reading. They'll either
- // complete successfully or get an ERR_CONNECTION_CLOSED when the socket is
- // closed.
+ CloseAllStreamsAfter(last_accepted_stream_id, net::ERR_ABORTED);
}
void SpdySession::OnPing(uint32 unique_id) {
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698