| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/quic/quic_flow_controller.h" | 5 #include "net/quic/quic_flow_controller.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "net/quic/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
| 9 #include "net/quic/quic_flags.h" | 9 #include "net/quic/quic_flags.h" |
| 10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Send WindowUpdate to increase receive window if | 169 // Send WindowUpdate to increase receive window if |
| 170 // (receive window offset - consumed bytes) < (max window / 2). | 170 // (receive window offset - consumed bytes) < (max window / 2). |
| 171 // This is behaviour copied from SPDY. | 171 // This is behaviour copied from SPDY. |
| 172 DCHECK_LE(bytes_consumed_, receive_window_offset_); | 172 DCHECK_LE(bytes_consumed_, receive_window_offset_); |
| 173 QuicStreamOffset available_window = receive_window_offset_ - bytes_consumed_; | 173 QuicStreamOffset available_window = receive_window_offset_ - bytes_consumed_; |
| 174 QuicByteCount threshold = WindowUpdateThreshold(); | 174 QuicByteCount threshold = WindowUpdateThreshold(); |
| 175 | 175 |
| 176 if (available_window >= threshold) { | 176 if (available_window >= threshold) { |
| 177 DVLOG(1) << ENDPOINT << "Not sending WindowUpdate for stream " << id_ | 177 DVLOG(1) << ENDPOINT << "Not sending WindowUpdate for stream " << id_ |
| 178 << ", available window: " << available_window | 178 << ", available window: " << available_window |
| 179 << ">= threshold: " << threshold; | 179 << " >= threshold: " << threshold; |
| 180 return; | 180 return; |
| 181 } | 181 } |
| 182 | 182 |
| 183 MaybeIncreaseMaxWindowSize(); | 183 MaybeIncreaseMaxWindowSize(); |
| 184 | 184 |
| 185 // Update our receive window. | 185 // Update our receive window. |
| 186 receive_window_offset_ += (receive_window_size_ - available_window); | 186 receive_window_offset_ += (receive_window_size_ - available_window); |
| 187 | 187 |
| 188 DVLOG(1) << ENDPOINT << "Sending WindowUpdate frame for stream " << id_ | 188 DVLOG(1) << ENDPOINT << "Sending WindowUpdate frame for stream " << id_ |
| 189 << ", consumed bytes: " << bytes_consumed_ | 189 << ", consumed bytes: " << bytes_consumed_ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 if (receive_window_size_ != receive_window_offset_) { | 247 if (receive_window_size_ != receive_window_offset_) { |
| 248 LOG(DFATAL) << "receive_window_size_:" << receive_window_size_ | 248 LOG(DFATAL) << "receive_window_size_:" << receive_window_size_ |
| 249 << " != receive_window_offset:" << receive_window_offset_; | 249 << " != receive_window_offset:" << receive_window_offset_; |
| 250 return; | 250 return; |
| 251 } | 251 } |
| 252 receive_window_size_ = size; | 252 receive_window_size_ = size; |
| 253 receive_window_offset_ = size; | 253 receive_window_offset_ = size; |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace net | 256 } // namespace net |
| OLD | NEW |