Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 | 342 |
| 343 void SpdyStream::DecreaseRecvWindowSize(int32 delta_window_size) { | 343 void SpdyStream::DecreaseRecvWindowSize(int32 delta_window_size) { |
| 344 DCHECK(session_->IsStreamActive(stream_id_)); | 344 DCHECK(session_->IsStreamActive(stream_id_)); |
| 345 DCHECK_GE(session_->flow_control_state(), SpdySession::FLOW_CONTROL_STREAM); | 345 DCHECK_GE(session_->flow_control_state(), SpdySession::FLOW_CONTROL_STREAM); |
| 346 DCHECK_GE(delta_window_size, 1); | 346 DCHECK_GE(delta_window_size, 1); |
| 347 | 347 |
| 348 // Since we never decrease the initial receive window size, | 348 // Since we never decrease the initial receive window size, |
| 349 // |delta_window_size| should never cause |recv_window_size_| to go | 349 // |delta_window_size| should never cause |recv_window_size_| to go |
| 350 // negative. If we do, the receive window isn't being respected. | 350 // negative. If we do, the receive window isn't being respected. |
| 351 if (delta_window_size > recv_window_size_) { | 351 if (delta_window_size > recv_window_size_) { |
| 352 session_->ResetStream( | 352 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR, |
| 353 stream_id_, RST_STREAM_PROTOCOL_ERROR, | 353 std::string("delta_window_size is ") |
| 354 "delta_window_size is " + base::IntToString(delta_window_size) + | 354 .append(base::IntToString(delta_window_size)) |
| 355 " in DecreaseRecvWindowSize, which is larger than the receive " + | 355 .append( |
| 356 "window size of " + base::IntToString(recv_window_size_)); | 356 " in DecreaseRecvWindowSize, which is " |
| 357 "larger than the receive window size of ") | |
| 358 .append(base::IntToString(recv_window_size_))); | |
|
mmenke
2015/03/09 20:21:58
Worth considering std::StringPrintf here, too?
| |
| 357 return; | 359 return; |
| 358 } | 360 } |
| 359 | 361 |
| 360 recv_window_size_ -= delta_window_size; | 362 recv_window_size_ -= delta_window_size; |
| 361 net_log_.AddEvent( | 363 net_log_.AddEvent( |
| 362 NetLog::TYPE_SPDY_STREAM_UPDATE_RECV_WINDOW, | 364 NetLog::TYPE_SPDY_STREAM_UPDATE_RECV_WINDOW, |
| 363 base::Bind(&NetLogSpdyStreamWindowUpdateCallback, | 365 base::Bind(&NetLogSpdyStreamWindowUpdateCallback, |
| 364 stream_id_, -delta_window_size, recv_window_size_)); | 366 stream_id_, -delta_window_size, recv_window_size_)); |
| 365 } | 367 } |
| 366 | 368 |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 913 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 915 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
| 914 state); | 916 state); |
| 915 break; | 917 break; |
| 916 } | 918 } |
| 917 return description; | 919 return description; |
| 918 } | 920 } |
| 919 | 921 |
| 920 #undef STATE_CASE | 922 #undef STATE_CASE |
| 921 | 923 |
| 922 } // namespace net | 924 } // namespace net |
| OLD | NEW |