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

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

Issue 1051213006: Fix flow control enforcement condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/packet/data frame/g Created 5 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 3186 matching lines...) Expand 10 before | Expand all | Expand 10 after
3197 HIGHEST); 3197 HIGHEST);
3198 session_unacked_recv_window_bytes_ = 0; 3198 session_unacked_recv_window_bytes_ = 0;
3199 } 3199 }
3200 } 3200 }
3201 3201
3202 void SpdySession::DecreaseRecvWindowSize(int32 delta_window_size) { 3202 void SpdySession::DecreaseRecvWindowSize(int32 delta_window_size) {
3203 CHECK(in_io_loop_); 3203 CHECK(in_io_loop_);
3204 DCHECK_EQ(flow_control_state_, FLOW_CONTROL_STREAM_AND_SESSION); 3204 DCHECK_EQ(flow_control_state_, FLOW_CONTROL_STREAM_AND_SESSION);
3205 DCHECK_GE(delta_window_size, 1); 3205 DCHECK_GE(delta_window_size, 1);
3206 3206
3207 // Since we never decrease the initial receive window size, 3207 // The receiving window size as the peer knows it is
3208 // |delta_window_size| should never cause |recv_window_size_| to go 3208 // |session_recv_window_size_ - session_unacked_recv_window_bytes_|, if more
3209 // negative. If we do, the receive window isn't being respected. 3209 // data are sent by the peer, that means that the receive window is not being
3210 if (delta_window_size > session_recv_window_size_) { 3210 // respected.
3211 if (delta_window_size >
3212 session_recv_window_size_ - session_unacked_recv_window_bytes_) {
3211 RecordProtocolErrorHistogram(PROTOCOL_ERROR_RECEIVE_WINDOW_VIOLATION); 3213 RecordProtocolErrorHistogram(PROTOCOL_ERROR_RECEIVE_WINDOW_VIOLATION);
3212 DoDrainSession( 3214 DoDrainSession(
3213 ERR_SPDY_FLOW_CONTROL_ERROR, 3215 ERR_SPDY_FLOW_CONTROL_ERROR,
3214 "delta_window_size is " + base::IntToString(delta_window_size) + 3216 "delta_window_size is " + base::IntToString(delta_window_size) +
3215 " in DecreaseRecvWindowSize, which is larger than the receive " + 3217 " in DecreaseRecvWindowSize, which is larger than the receive " +
3216 "window size of " + base::IntToString(session_recv_window_size_)); 3218 "window size of " + base::IntToString(session_recv_window_size_));
3217 return; 3219 return;
3218 } 3220 }
3219 3221
3220 session_recv_window_size_ -= delta_window_size; 3222 session_recv_window_size_ -= delta_window_size;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 if (!queue->empty()) { 3269 if (!queue->empty()) {
3268 SpdyStreamId stream_id = queue->front(); 3270 SpdyStreamId stream_id = queue->front();
3269 queue->pop_front(); 3271 queue->pop_front();
3270 return stream_id; 3272 return stream_id;
3271 } 3273 }
3272 } 3274 }
3273 return 0; 3275 return 0;
3274 } 3276 }
3275 3277
3276 } // namespace net 3278 } // namespace net
OLDNEW
« 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