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

Side by Side Diff: net/spdy/spdy_stream.cc

Issue 1051213006: Fix flow control enforcement condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change error code. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_stream.h" 5 #include "net/spdy/spdy_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 stream_id_, static_cast<uint32>(unacked_recv_window_bytes_)); 340 stream_id_, static_cast<uint32>(unacked_recv_window_bytes_));
341 unacked_recv_window_bytes_ = 0; 341 unacked_recv_window_bytes_ = 0;
342 } 342 }
343 } 343 }
344 344
345 void SpdyStream::DecreaseRecvWindowSize(int32 delta_window_size) { 345 void SpdyStream::DecreaseRecvWindowSize(int32 delta_window_size) {
346 DCHECK(session_->IsStreamActive(stream_id_)); 346 DCHECK(session_->IsStreamActive(stream_id_));
347 DCHECK_GE(session_->flow_control_state(), SpdySession::FLOW_CONTROL_STREAM); 347 DCHECK_GE(session_->flow_control_state(), SpdySession::FLOW_CONTROL_STREAM);
348 DCHECK_GE(delta_window_size, 1); 348 DCHECK_GE(delta_window_size, 1);
349 349
350 // Since we never decrease the initial receive window size, 350 // The receiving window size as the peer knows it is
351 // |delta_window_size| should never cause |recv_window_size_| to go 351 // |recv_window_size_ - unacked_recv_window_bytes_|, if more data are sent by
352 // negative. If we do, the receive window isn't being respected. 352 // the peer, that means that the receive window is not being respected.
353 if (delta_window_size > recv_window_size_) { 353 if (delta_window_size > recv_window_size_ - unacked_recv_window_bytes_) {
354 session_->ResetStream( 354 session_->ResetStream(
355 stream_id_, RST_STREAM_PROTOCOL_ERROR, 355 stream_id_, RST_STREAM_FLOW_CONTROL_ERROR,
356 "delta_window_size is " + base::IntToString(delta_window_size) + 356 "delta_window_size is " + base::IntToString(delta_window_size) +
357 " in DecreaseRecvWindowSize, which is larger than the receive " + 357 " in DecreaseRecvWindowSize, which is larger than the receive " +
358 "window size of " + base::IntToString(recv_window_size_)); 358 "window size of " + base::IntToString(recv_window_size_));
359 return; 359 return;
360 } 360 }
361 361
362 recv_window_size_ -= delta_window_size; 362 recv_window_size_ -= delta_window_size;
363 net_log_.AddEvent( 363 net_log_.AddEvent(
364 NetLog::TYPE_HTTP2_STREAM_UPDATE_RECV_WINDOW, 364 NetLog::TYPE_HTTP2_STREAM_UPDATE_RECV_WINDOW,
365 base::Bind(&NetLogSpdyStreamWindowUpdateCallback, stream_id_, 365 base::Bind(&NetLogSpdyStreamWindowUpdateCallback, stream_id_,
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 928 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
929 state); 929 state);
930 break; 930 break;
931 } 931 }
932 return description; 932 return description;
933 } 933 }
934 934
935 #undef STATE_CASE 935 #undef STATE_CASE
936 936
937 } // namespace net 937 } // namespace net
OLDNEW
« net/spdy/spdy_session_unittest.cc ('K') | « net/spdy/spdy_session_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698