| 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/quic/congestion_control/tcp_cubic_sender_packets.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "net/quic/congestion_control/prr_sender.h" | 10 #include "net/quic/congestion_control/prr_sender.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void TcpCubicSenderPackets::OnPacketLost(QuicPacketNumber packet_number, | 82 void TcpCubicSenderPackets::OnPacketLost(QuicPacketNumber packet_number, |
| 83 QuicByteCount lost_bytes, | 83 QuicByteCount lost_bytes, |
| 84 QuicByteCount bytes_in_flight) { | 84 QuicByteCount bytes_in_flight) { |
| 85 // TCP NewReno (RFC6582) says that once a loss occurs, any losses in packets | 85 // TCP NewReno (RFC6582) says that once a loss occurs, any losses in packets |
| 86 // already sent should be treated as a single loss event, since it's expected. | 86 // already sent should be treated as a single loss event, since it's expected. |
| 87 if (packet_number <= largest_sent_at_last_cutback_) { | 87 if (packet_number <= largest_sent_at_last_cutback_) { |
| 88 if (last_cutback_exited_slowstart_) { | 88 if (last_cutback_exited_slowstart_) { |
| 89 ++stats_->slowstart_packets_lost; | 89 ++stats_->slowstart_packets_lost; |
| 90 stats_->slowstart_bytes_lost += lost_bytes; | 90 stats_->slowstart_bytes_lost += lost_bytes; |
| 91 if (slow_start_large_reduction_) { | 91 if (slow_start_large_reduction_) { |
| 92 if (FLAGS_quic_sslr_byte_conservation) { | 92 if (stats_->slowstart_packets_lost == 1 || |
| 93 if (stats_->slowstart_packets_lost == 1 || | 93 (stats_->slowstart_bytes_lost / kDefaultTCPMSS) > |
| 94 (stats_->slowstart_bytes_lost / kDefaultTCPMSS) > | 94 (stats_->slowstart_bytes_lost - lost_bytes) / kDefaultTCPMSS) { |
| 95 (stats_->slowstart_bytes_lost - lost_bytes) / | 95 // Reduce congestion window by 1 for every mss of bytes lost. |
| 96 kDefaultTCPMSS) { | |
| 97 // Reduce congestion window by 1 for every mss of bytes lost. | |
| 98 congestion_window_ = | |
| 99 max(congestion_window_ - 1, min_congestion_window_); | |
| 100 } | |
| 101 } else { | |
| 102 // Reduce congestion window by 1 for every loss. | |
| 103 congestion_window_ = | 96 congestion_window_ = |
| 104 max(congestion_window_ - 1, min_congestion_window_); | 97 max(congestion_window_ - 1, min_congestion_window_); |
| 105 } | 98 } |
| 106 slowstart_threshold_ = congestion_window_; | 99 slowstart_threshold_ = congestion_window_; |
| 107 } | 100 } |
| 108 } | 101 } |
| 109 DVLOG(1) << "Ignoring loss for largest_missing:" << packet_number | 102 DVLOG(1) << "Ignoring loss for largest_missing:" << packet_number |
| 110 << " because it was sent prior to the last CWND cutback."; | 103 << " because it was sent prior to the last CWND cutback."; |
| 111 return; | 104 return; |
| 112 } | 105 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 congestion_window_ = initial_tcp_congestion_window_; | 201 congestion_window_ = initial_tcp_congestion_window_; |
| 209 slowstart_threshold_ = initial_max_tcp_congestion_window_; | 202 slowstart_threshold_ = initial_max_tcp_congestion_window_; |
| 210 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; | 203 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; |
| 211 } | 204 } |
| 212 | 205 |
| 213 CongestionControlType TcpCubicSenderPackets::GetCongestionControlType() const { | 206 CongestionControlType TcpCubicSenderPackets::GetCongestionControlType() const { |
| 214 return reno_ ? kReno : kCubic; | 207 return reno_ ? kReno : kCubic; |
| 215 } | 208 } |
| 216 | 209 |
| 217 } // namespace net | 210 } // namespace net |
| OLD | NEW |