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

Unified Diff: net/quic/congestion_control/rtt_stats.cc

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/congestion_control/prr_sender_test.cc ('k') | net/quic/congestion_control/rtt_stats_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/congestion_control/rtt_stats.cc
diff --git a/net/quic/congestion_control/rtt_stats.cc b/net/quic/congestion_control/rtt_stats.cc
index 2eb0b8d5510cd71f26745429fe02ff832c0595a1..7b25b6c6d373268a76a2085e4f20b056d859e41d 100644
--- a/net/quic/congestion_control/rtt_stats.cc
+++ b/net/quic/congestion_control/rtt_stats.cc
@@ -53,30 +53,30 @@ void RttStats::ExpireSmoothedMetrics() {
void RttStats::UpdateRtt(QuicTime::Delta send_delta,
QuicTime::Delta ack_delay,
QuicTime now) {
- QuicTime::Delta rtt_sample(QuicTime::Delta::Zero());
- if (send_delta > ack_delay) {
- rtt_sample = send_delta.Subtract(ack_delay);
- } else if (!HasUpdates()) {
- // Even though we received information from the peer suggesting
- // an invalid (negative) RTT, we can use the send delta as an
- // approximation until we get a better estimate.
- rtt_sample = send_delta;
- }
-
- if (rtt_sample.IsInfinite() || rtt_sample.IsZero()) {
- DVLOG(1) << "Ignoring rtt, because it's "
- << (rtt_sample.IsZero() ? "Zero" : "Infinite");
+ if (send_delta.IsInfinite() || send_delta <= QuicTime::Delta::Zero()) {
+ LOG(WARNING) << "Ignoring measured send_delta, because it's is "
+ << "either infinite, zero, or negative. send_delta = "
+ << send_delta.ToMicroseconds();
return;
}
- // RTT can't be non-positive.
- DCHECK_LT(0, rtt_sample.ToMicroseconds());
- latest_rtt_ = rtt_sample;
- // First time call or link delay decreases.
- if (min_rtt_.IsZero() || min_rtt_ > rtt_sample) {
- min_rtt_ = rtt_sample;
+ // Update min_rtt_ first. min_rtt_ does not use an rtt_sample corrected for
+ // ack_delay but the raw observed send_delta, since poor clock granularity at
+ // the client may cause a high ack_delay to result in underestimation of the
+ // min_rtt_.
+ if (min_rtt_.IsZero() || min_rtt_ > send_delta) {
+ min_rtt_ = send_delta;
}
- UpdateRecentMinRtt(rtt_sample, now);
+ UpdateRecentMinRtt(send_delta, now);
+
+ // Correct for ack_delay if information received from the peer results in a
+ // positive RTT sample. Otherwise, we use the send_delta as a reasonable
+ // measure for smoothed_rtt.
+ QuicTime::Delta rtt_sample(send_delta);
+ if (rtt_sample > ack_delay) {
+ rtt_sample = rtt_sample.Subtract(ack_delay);
+ }
+ latest_rtt_ = rtt_sample;
// First time call.
if (!HasUpdates()) {
smoothed_rtt_ = rtt_sample;
« no previous file with comments | « net/quic/congestion_control/prr_sender_test.cc ('k') | net/quic/congestion_control/rtt_stats_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698