diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-08 23:19:08 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-08 23:19:08 +0000 |
commit | 0e86578202902b7918988dfcba2200e68a38859a (patch) | |
tree | 4f7604b4c87509a58ed0c91050e9ac5b84ff80c6 | |
parent | b1ac5d5e3b2ada198ddd8dc71d49c0b7918a6de7 (diff) | |
download | chromium_src-0e86578202902b7918988dfcba2200e68a38859a.zip chromium_src-0e86578202902b7918988dfcba2200e68a38859a.tar.gz chromium_src-0e86578202902b7918988dfcba2200e68a38859a.tar.bz2 |
Merge 120855 - SPDY - Adjust the send window size of all streams (new and current)
based on initial window size sent in settings frame from the server.
R=willchan
BUG=112778
TEST=network unit tests
Review URL: http://codereview.chromium.org/9346003
TBR=rtenneti@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9371001
git-svn-id: svn://svn.chromium.org/chrome/branches/1025_7/src@121086 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/spdy/spdy_session.cc | 33 | ||||
-rw-r--r-- | net/spdy/spdy_session.h | 3 | ||||
-rw-r--r-- | net/spdy/spdy_stream.cc | 6 | ||||
-rw-r--r-- | net/spdy/spdy_stream.h | 5 |
4 files changed, 45 insertions, 2 deletions
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 7f9d8166..6049cf9 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -1217,6 +1217,8 @@ void SpdySession::OnSyn(const spdy::SpdySynStreamControlFrame& frame, new SpdyStream(this, stream_id, true, net_log_)); stream->set_path(gurl.PathForRequest()); + stream->set_send_window_size(initial_send_window_size_); + stream->set_recv_window_size(initial_recv_window_size_); unclaimed_pushed_streams_[url] = stream; @@ -1572,6 +1574,37 @@ void SpdySession::HandleSettings(const spdy::SpdySettings& settings) { max_concurrent_stream_limit_); ProcessPendingCreateStreams(); break; + case spdy::SETTINGS_INITIAL_WINDOW_SIZE: + int prev_initial_send_window_size = initial_send_window_size_; + initial_send_window_size_ = static_cast<size_t>(val); + int32 delta_window_size = + initial_send_window_size_ - prev_initial_send_window_size; + UpdateStreamsSendWindowSize(delta_window_size); + break; + } + } +} + +void SpdySession::UpdateStreamsSendWindowSize(int32 delta_window_size) { + ActiveStreamMap::iterator it; + for (it = active_streams_.begin(); it != active_streams_.end(); ++it) { + const scoped_refptr<SpdyStream>& stream = it->second; + DCHECK(stream); + stream->AdjustSendWindowSize(delta_window_size); + } + + for (int i = 0; i < NUM_PRIORITIES; ++i) { + PendingCreateStreamQueue tmp; + while (!create_stream_queues_[i].empty()) { + PendingCreateStream pending_create = create_stream_queues_[i].front(); + const scoped_refptr<SpdyStream>& stream = *(pending_create.spdy_stream); + stream->AdjustSendWindowSize(delta_window_size); + create_stream_queues_[i].pop(); + tmp.push(pending_create); + } + while (!tmp.empty()) { + create_stream_queues_[i].push(tmp.front()); + tmp.pop(); } } } diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index 20570be..5514d4c 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h @@ -330,6 +330,9 @@ class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, // SETTINGS control frame, update our SpdySession accordingly. void HandleSettings(const spdy::SpdySettings& settings); + // Adjust the send window size of all ActiveStreams and PendingCreateStreams. + void UpdateStreamsSendWindowSize(int32 delta_window_size); + // Send the PING (preface-PING and trailing-PING) frames. void SendPrefacePingIfNoneInFlight(); diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc index 49fbf04..d34f674 100644 --- a/net/spdy/spdy_stream.cc +++ b/net/spdy/spdy_stream.cc @@ -128,6 +128,10 @@ void SpdyStream::set_spdy_headers( request_ = headers; } +void SpdyStream::AdjustSendWindowSize(int delta_window_size) { + send_window_size_ = send_window_size_ + delta_window_size; +} + void SpdyStream::IncreaseSendWindowSize(int delta_window_size) { DCHECK_GE(delta_window_size, 1); int new_window_size = send_window_size_ + delta_window_size; @@ -157,7 +161,7 @@ void SpdyStream::IncreaseSendWindowSize(int delta_window_size) { NetLog::TYPE_SPDY_STREAM_SEND_WINDOW_UPDATE, make_scoped_refptr(new NetLogSpdyStreamWindowUpdateParameter( stream_id_, delta_window_size, send_window_size_))); - if (stalled_by_flow_control_) { + if (send_window_size_ > 0 && stalled_by_flow_control_) { stalled_by_flow_control_ = false; io_state_ = STATE_SEND_BODY; DoLoop(OK); diff --git a/net/spdy/spdy_stream.h b/net/spdy/spdy_stream.h index f022322..64b7060 100644 --- a/net/spdy/spdy_stream.h +++ b/net/spdy/spdy_stream.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -137,6 +137,9 @@ class NET_EXPORT_PRIVATE SpdyStream stalled_by_flow_control_ = stalled; } + // Adjust the |send_window_size_| by |delta_window_size|. + void AdjustSendWindowSize(int delta_window_size); + // Increases |send_window_size_| with delta extracted from a WINDOW_UPDATE // frame; sends a RST_STREAM if delta overflows |send_window_size_| and // removes the stream from the session. |