summaryrefslogtreecommitdiffstats
path: root/net/spdy/spdy_stream.cc
diff options
context:
space:
mode:
authoragayev@chromium.org <agayev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 14:16:27 +0000
committeragayev@chromium.org <agayev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 14:16:27 +0000
commit5af3c573076a8f04c285d6a0c40237462375e7c5 (patch)
tree3161f03d9e617a1499a83c2413faa435682c10a7 /net/spdy/spdy_stream.cc
parent1442b29a275b076203b5e0a78206fe3feda3b739 (diff)
downloadchromium_src-5af3c573076a8f04c285d6a0c40237462375e7c5.zip
chromium_src-5af3c573076a8f04c285d6a0c40237462375e7c5.tar.gz
chromium_src-5af3c573076a8f04c285d6a0c40237462375e7c5.tar.bz2
Initial SPDY flow control support
BUG=48100 TEST=net_unittests --gtest_filter="SpdyProtocolTest.ControlFrameStructs:SpdyNetworkTransactionTest.WindowSizeChange:SpdyNetworkTransactionTest.WindowSizeOverflow" Contributed by: agayev@google.com Review URL: http://codereview.chromium.org/2805083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53039 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy/spdy_stream.cc')
-rw-r--r--net/spdy/spdy_stream.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index 7218699..a5f9d1f 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -71,6 +71,25 @@ void SpdyStream::set_spdy_headers(
request_ = headers;
}
+void SpdyStream::UpdateWindowSize(int delta_window_size) {
+ DCHECK_GE(delta_window_size, 1);
+ int new_window_size = window_size_ + delta_window_size;
+
+ // it's valid for window_size_ to become negative (via an incoming
+ // SETTINGS frame which is handled in SpdySession::OnSettings), in which
+ // case incoming WINDOW_UPDATEs will eventually make it positive;
+ // however, if window_size_ is positive and incoming WINDOW_UPDATE makes
+ // it negative, we have an overflow.
+ if (window_size_ > 0 && new_window_size < 0) {
+ LOG(WARNING) << "Received WINDOW_UPDATE [delta:" << delta_window_size
+ << "] for stream " << stream_id_
+ << " overflows window size [current:" << window_size_ << "]";
+ session_->ResetStream(stream_id_, spdy::FLOW_CONTROL_ERROR);
+ return;
+ }
+ window_size_ = new_window_size;
+}
+
base::Time SpdyStream::GetRequestTime() const {
return request_time_;
}