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

Unified Diff: net/spdy/spdy_session.cc

Issue 287063003: Correct SpdySession StreamID exhaustion behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment tweaks. Created 6 years, 7 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
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 4c4900f5d8fd937612fa522491050cdc4459a867..760804207048e2cdfa8fb8befcc2858cf2766ee4 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -49,8 +49,9 @@ const int kReadBufferSize = 8 * 1024;
const int kDefaultConnectionAtRiskOfLossSeconds = 10;
const int kHungIntervalSeconds = 10;
-// Always start at 1 for the first stream id.
+// As we always act as the client, start at 1 for the first stream id.
const SpdyStreamId kFirstStreamId = 1;
+const SpdyStreamId kLastStreamId = 0x7fffffff;
// Minimum seconds that unclaimed pushed streams will be kept in memory.
const int kMinPushedStreamLifetimeSeconds = 300;
@@ -1384,6 +1385,14 @@ int SpdySession::DoWrite() {
scoped_ptr<SpdyStream> owned_stream =
ActivateCreatedStream(stream.get());
InsertActivatedStream(owned_stream.Pass());
+
+ if (stream_hi_water_mark_ > kLastStreamId) {
+ CHECK_EQ(stream->stream_id(), kLastStreamId);
+ // We've exhausted the stream ID space, and no new streams may be
+ // created after this one.
+ MakeUnavailable();
+ StartGoingAway(kLastStreamId, ERR_ABORTED);
+ }
}
in_flight_write_ = producer->ProduceBuffer();
@@ -1610,11 +1619,10 @@ void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it,
}
}
-int SpdySession::GetNewStreamId() {
- int id = stream_hi_water_mark_;
+SpdyStreamId SpdySession::GetNewStreamId() {
+ CHECK_LE(stream_hi_water_mark_, kLastStreamId);
+ SpdyStreamId id = stream_hi_water_mark_;
stream_hi_water_mark_ += 2;
- if (stream_hi_water_mark_ > 0x7fff)
- stream_hi_water_mark_ = 1;
return id;
}
« 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