summaryrefslogtreecommitdiffstats
path: root/net/quic/congestion_control/tcp_cubic_sender.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/quic/congestion_control/tcp_cubic_sender.cc')
-rw-r--r--net/quic/congestion_control/tcp_cubic_sender.cc47
1 files changed, 22 insertions, 25 deletions
diff --git a/net/quic/congestion_control/tcp_cubic_sender.cc b/net/quic/congestion_control/tcp_cubic_sender.cc
index 5e1fb25..e39b243 100644
--- a/net/quic/congestion_control/tcp_cubic_sender.cc
+++ b/net/quic/congestion_control/tcp_cubic_sender.cc
@@ -40,8 +40,8 @@ TcpCubicSender::TcpCubicSender(const QuicClock* clock,
reno_(reno),
num_connections_(kDefaultNumConnections),
congestion_window_count_(0),
- largest_sent_sequence_number_(0),
- largest_acked_sequence_number_(0),
+ largest_sent_packet_number_(0),
+ largest_acked_packet_number_(0),
largest_sent_at_last_cutback_(0),
congestion_window_(initial_tcp_congestion_window),
min_congestion_window_(kDefaultMinimumCongestionWindow),
@@ -49,8 +49,7 @@ TcpCubicSender::TcpCubicSender(const QuicClock* clock,
slowstart_threshold_(max_tcp_congestion_window),
last_cutback_exited_slowstart_(false),
max_tcp_congestion_window_(max_tcp_congestion_window),
- clock_(clock) {
-}
+ clock_(clock) {}
TcpCubicSender::~TcpCubicSender() {
UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_);
@@ -149,31 +148,30 @@ void TcpCubicSender::OnCongestionEvent(
}
}
-void TcpCubicSender::OnPacketAcked(
- QuicPacketSequenceNumber acked_sequence_number,
- QuicByteCount acked_bytes,
- QuicByteCount bytes_in_flight) {
- largest_acked_sequence_number_ = max(acked_sequence_number,
- largest_acked_sequence_number_);
+void TcpCubicSender::OnPacketAcked(QuicPacketNumber acked_packet_number,
+ QuicByteCount acked_bytes,
+ QuicByteCount bytes_in_flight) {
+ largest_acked_packet_number_ =
+ max(acked_packet_number, largest_acked_packet_number_);
if (InRecovery()) {
// PRR is used when in recovery.
prr_.OnPacketAcked(acked_bytes);
return;
}
- MaybeIncreaseCwnd(acked_sequence_number, bytes_in_flight);
+ MaybeIncreaseCwnd(acked_packet_number, bytes_in_flight);
// TODO(ianswett): Should this even be called when not in slow start?
- hybrid_slow_start_.OnPacketAcked(acked_sequence_number, InSlowStart());
+ hybrid_slow_start_.OnPacketAcked(acked_packet_number, InSlowStart());
}
-void TcpCubicSender::OnPacketLost(QuicPacketSequenceNumber sequence_number,
+void TcpCubicSender::OnPacketLost(QuicPacketNumber packet_number,
QuicByteCount bytes_in_flight) {
// TCP NewReno (RFC6582) says that once a loss occurs, any losses in packets
// already sent should be treated as a single loss event, since it's expected.
- if (sequence_number <= largest_sent_at_last_cutback_) {
+ if (packet_number <= largest_sent_at_last_cutback_) {
if (last_cutback_exited_slowstart_) {
++stats_->slowstart_packets_lost;
}
- DVLOG(1) << "Ignoring loss for largest_missing:" << sequence_number
+ DVLOG(1) << "Ignoring loss for largest_missing:" << packet_number
<< " because it was sent prior to the last CWND cutback.";
return;
}
@@ -196,7 +194,7 @@ void TcpCubicSender::OnPacketLost(QuicPacketSequenceNumber sequence_number,
if (congestion_window_ < min_congestion_window_) {
congestion_window_ = min_congestion_window_;
}
- largest_sent_at_last_cutback_ = largest_sent_sequence_number_;
+ largest_sent_at_last_cutback_ = largest_sent_packet_number_;
// reset packet count from congestion avoidance mode. We start
// counting again when we're out of recovery.
congestion_window_count_ = 0;
@@ -206,7 +204,7 @@ void TcpCubicSender::OnPacketLost(QuicPacketSequenceNumber sequence_number,
bool TcpCubicSender::OnPacketSent(QuicTime /*sent_time*/,
QuicByteCount /*bytes_in_flight*/,
- QuicPacketSequenceNumber sequence_number,
+ QuicPacketNumber packet_number,
QuicByteCount bytes,
HasRetransmittableData is_retransmittable) {
if (InSlowStart()) {
@@ -221,9 +219,9 @@ bool TcpCubicSender::OnPacketSent(QuicTime /*sent_time*/,
// PRR is used when in recovery.
prr_.OnPacketSent(bytes);
}
- DCHECK_LT(largest_sent_sequence_number_, sequence_number);
- largest_sent_sequence_number_ = sequence_number;
- hybrid_slow_start_.OnPacketSent(sequence_number);
+ DCHECK_LT(largest_sent_packet_number_, packet_number);
+ largest_sent_packet_number_ = packet_number;
+ hybrid_slow_start_.OnPacketSent(packet_number);
return true;
}
@@ -304,15 +302,14 @@ bool TcpCubicSender::IsCwndLimited(QuicByteCount bytes_in_flight) const {
}
bool TcpCubicSender::InRecovery() const {
- return largest_acked_sequence_number_ <= largest_sent_at_last_cutback_ &&
- largest_acked_sequence_number_ != 0;
+ return largest_acked_packet_number_ <= largest_sent_at_last_cutback_ &&
+ largest_acked_packet_number_ != 0;
}
// Called when we receive an ack. Normal TCP tracks how many packets one ack
// represents, but quic has a separate ack for each packet.
-void TcpCubicSender::MaybeIncreaseCwnd(
- QuicPacketSequenceNumber acked_sequence_number,
- QuicByteCount bytes_in_flight) {
+void TcpCubicSender::MaybeIncreaseCwnd(QuicPacketNumber acked_packet_number,
+ QuicByteCount bytes_in_flight) {
LOG_IF(DFATAL, InRecovery()) << "Never increase the CWND during recovery.";
if (!IsCwndLimited(bytes_in_flight)) {
// We don't update the congestion window unless we are close to using the