Index: net/quic/congestion_control/send_algorithm_simulator.cc |
diff --git a/net/quic/congestion_control/send_algorithm_simulator.cc b/net/quic/congestion_control/send_algorithm_simulator.cc |
index 2e6bb23ad22d1ddb7033810b712cb8f7afddaac0..5c55f5b5d69d225486d7daefe22ba0592924bc76 100644 |
--- a/net/quic/congestion_control/send_algorithm_simulator.cc |
+++ b/net/quic/congestion_control/send_algorithm_simulator.cc |
@@ -34,7 +34,8 @@ SendAlgorithmSimulator::Sender::Sender(SendAlgorithmInterface* send_algorithm, |
min_cwnd(100000), |
max_cwnd_drop(0), |
last_cwnd(0), |
- last_transfer_bandwidth(QuicBandwidth::Zero()) {} |
+ last_transfer_bandwidth(QuicBandwidth::Zero()), |
+ last_transfer_loss_rate(0) {} |
SendAlgorithmSimulator::SendAlgorithmSimulator( |
MockClock* clock, |
@@ -268,10 +269,13 @@ void SendAlgorithmSimulator::HandlePendingAck(Transfer* transfer) { |
sender->RecordStats(); |
transfer->bytes_acked += acked_packets.size() * kPacketSize; |
+ transfer->bytes_lost += lost_packets.size() * kPacketSize; |
if (transfer->bytes_acked >= transfer->num_bytes) { |
// Remove completed transfers and record transfer bandwidth. |
QuicTime::Delta transfer_time = |
clock_->Now().Subtract(transfer->start_time); |
+ sender->last_transfer_loss_rate = static_cast<float>(transfer->bytes_lost) / |
+ (transfer->bytes_lost + transfer->bytes_acked); |
sender->last_transfer_bandwidth = |
QuicBandwidth::FromBytesAndTimeDelta(transfer->num_bytes, |
transfer_time); |