| 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/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "net/quic/quic_bug_tracker.h" | 8 #include "net/quic/quic_bug_tracker.h" |
| 9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
| 10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 void QuicFlowController::MaybeIncreaseMaxWindowSize() { | 103 void QuicFlowController::MaybeIncreaseMaxWindowSize() { |
| 104 // Core of receive window auto tuning. This method should be called before a | 104 // Core of receive window auto tuning. This method should be called before a |
| 105 // WINDOW_UPDATE frame is sent. Ideally, window updates should occur close to | 105 // WINDOW_UPDATE frame is sent. Ideally, window updates should occur close to |
| 106 // once per RTT. If a window update happens much faster than RTT, it implies | 106 // once per RTT. If a window update happens much faster than RTT, it implies |
| 107 // that the flow control window is imposing a bottleneck. To prevent this, | 107 // that the flow control window is imposing a bottleneck. To prevent this, |
| 108 // this method will increase the receive window size (subject to a reasonable | 108 // this method will increase the receive window size (subject to a reasonable |
| 109 // upper bound). For simplicity this algorithm is deliberately asymmetric, in | 109 // upper bound). For simplicity this algorithm is deliberately asymmetric, in |
| 110 // that it may increase window size but never decreases. | 110 // that it may increase window size but never decreases. |
| 111 | 111 |
| 112 if (!FLAGS_quic_auto_tune_receive_window) { | |
| 113 return; | |
| 114 } | |
| 115 | |
| 116 // Keep track of timing between successive window updates. | 112 // Keep track of timing between successive window updates. |
| 117 QuicTime now = connection_->clock()->ApproximateNow(); | 113 QuicTime now = connection_->clock()->ApproximateNow(); |
| 118 QuicTime prev = prev_window_update_time_; | 114 QuicTime prev = prev_window_update_time_; |
| 119 prev_window_update_time_ = now; | 115 prev_window_update_time_ = now; |
| 120 if (!prev.IsInitialized()) { | 116 if (!prev.IsInitialized()) { |
| 121 DVLOG(1) << ENDPOINT << "first window update for stream " << id_; | 117 DVLOG(1) << ENDPOINT << "first window update for stream " << id_; |
| 122 return; | 118 return; |
| 123 } | 119 } |
| 124 | 120 |
| 125 if (!auto_tune_receive_window_) { | 121 if (!auto_tune_receive_window_) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 if (receive_window_size_ != receive_window_offset_) { | 245 if (receive_window_size_ != receive_window_offset_) { |
| 250 QUIC_BUG << "receive_window_size_:" << receive_window_size_ | 246 QUIC_BUG << "receive_window_size_:" << receive_window_size_ |
| 251 << " != receive_window_offset:" << receive_window_offset_; | 247 << " != receive_window_offset:" << receive_window_offset_; |
| 252 return; | 248 return; |
| 253 } | 249 } |
| 254 receive_window_size_ = size; | 250 receive_window_size_ = size; |
| 255 receive_window_offset_ = size; | 251 receive_window_offset_ = size; |
| 256 } | 252 } |
| 257 | 253 |
| 258 } // namespace net | 254 } // namespace net |
| OLD | NEW |