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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 // Get outbound RTT. | 129 // Get outbound RTT. |
130 QuicTime::Delta rtt = | 130 QuicTime::Delta rtt = |
131 connection_->sent_packet_manager().GetRttStats()->smoothed_rtt(); | 131 connection_->sent_packet_manager().GetRttStats()->smoothed_rtt(); |
132 if (rtt.IsZero()) { | 132 if (rtt.IsZero()) { |
133 DVLOG(1) << ENDPOINT << "rtt zero for stream " << id_; | 133 DVLOG(1) << ENDPOINT << "rtt zero for stream " << id_; |
134 return; | 134 return; |
135 } | 135 } |
136 | 136 |
137 // Now we can compare timing of window updates with RTT. | 137 // Now we can compare timing of window updates with RTT. |
138 QuicTime::Delta since_last = now.Subtract(prev); | 138 QuicTime::Delta since_last = now - prev; |
139 QuicTime::Delta two_rtt = rtt.Multiply(2); | 139 QuicTime::Delta two_rtt = 2 * rtt; |
140 | 140 |
141 if (since_last >= two_rtt) { | 141 if (since_last >= two_rtt) { |
142 // If interval between window updates is sufficiently large, there | 142 // If interval between window updates is sufficiently large, there |
143 // is no need to increase receive_window_size_. | 143 // is no need to increase receive_window_size_. |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 QuicByteCount old_window = receive_window_size_; | 147 QuicByteCount old_window = receive_window_size_; |
148 receive_window_size_ *= 2; | 148 receive_window_size_ *= 2; |
149 receive_window_size_ = | 149 receive_window_size_ = |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 if (receive_window_size_ != receive_window_offset_) { | 249 if (receive_window_size_ != receive_window_offset_) { |
250 QUIC_BUG << "receive_window_size_:" << receive_window_size_ | 250 QUIC_BUG << "receive_window_size_:" << receive_window_size_ |
251 << " != receive_window_offset:" << receive_window_offset_; | 251 << " != receive_window_offset:" << receive_window_offset_; |
252 return; | 252 return; |
253 } | 253 } |
254 receive_window_size_ = size; | 254 receive_window_size_ = size; |
255 receive_window_offset_ = size; | 255 receive_window_offset_ = size; |
256 } | 256 } |
257 | 257 |
258 } // namespace net | 258 } // namespace net |
OLD | NEW |