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

Unified Diff: net/spdy/spdy_session.cc

Issue 22610006: [SPDY] Count closed-stream DATA frames for session flow control (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak 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 | « no previous file | 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 db4754937463fae658a5ebe600f54206f20c08a2..baef19526526726821986a2f7dbe879ccf0baf5b 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -1806,6 +1806,26 @@ void SpdySession::OnStreamFrameData(SpdyStreamId stream_id,
base::Bind(&NetLogSpdyDataCallback, stream_id, len, fin));
}
+ // Build the buffer as early as possible so that we go through the
+ // session flow control checks and update
+ // |unacked_recv_window_bytes_| properly even when the stream is
+ // inactive (since the other side has still reduced its session send
+ // window).
+ scoped_ptr<SpdyBuffer> buffer;
+ if (data) {
+ DCHECK_GT(len, 0u);
+ buffer.reset(new SpdyBuffer(data, len));
+
+ if (flow_control_state_ == FLOW_CONTROL_STREAM_AND_SESSION) {
+ DecreaseRecvWindowSize(static_cast<int32>(len));
+ buffer->AddConsumeCallback(
+ base::Bind(&SpdySession::OnReadBufferConsumed,
+ weak_factory_.GetWeakPtr()));
+ }
+ } else {
+ DCHECK_EQ(len, 0u);
+ }
+
ActiveStreamMap::iterator it = active_streams_.find(stream_id);
// By the time data comes in, the stream may already be inactive.
@@ -1822,20 +1842,6 @@ void SpdySession::OnStreamFrameData(SpdyStreamId stream_id,
return;
}
- scoped_ptr<SpdyBuffer> buffer;
- if (data) {
- DCHECK_GT(len, 0u);
- buffer.reset(new SpdyBuffer(data, len));
-
- if (flow_control_state_ == FLOW_CONTROL_STREAM_AND_SESSION) {
- DecreaseRecvWindowSize(static_cast<int32>(len));
- buffer->AddConsumeCallback(
- base::Bind(&SpdySession::OnReadBufferConsumed,
- weak_factory_.GetWeakPtr()));
- }
- } else {
- DCHECK_EQ(len, 0u);
- }
stream->OnDataReceived(buffer.Pass());
}
« no previous file with comments | « no previous file | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698