OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "net/quic/congestion_control/pacing_sender.h" | 9 #include "net/quic/congestion_control/pacing_sender.h" |
10 #include "net/quic/crypto/crypto_protocol.h" | 10 #include "net/quic/crypto/crypto_protocol.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 392 |
393 unacked_packets_.SetPending(sequence_number, sent_time, bytes); | 393 unacked_packets_.SetPending(sequence_number, sent_time, bytes); |
394 | 394 |
395 // Reset the retransmission timer anytime a packet is sent in tail loss probe | 395 // Reset the retransmission timer anytime a packet is sent in tail loss probe |
396 // mode or before the crypto handshake has completed. | 396 // mode or before the crypto handshake has completed. |
397 return set_retransmission_timer || GetRetransmissionMode() != RTO_MODE; | 397 return set_retransmission_timer || GetRetransmissionMode() != RTO_MODE; |
398 } | 398 } |
399 | 399 |
400 void QuicSentPacketManager::OnRetransmissionTimeout() { | 400 void QuicSentPacketManager::OnRetransmissionTimeout() { |
401 DCHECK(unacked_packets_.HasPendingPackets()); | 401 DCHECK(unacked_packets_.HasPendingPackets()); |
402 // Handshake retransmission, TLP, and RTO are implemented with a single alarm. | 402 // Handshake retransmission, timer based loss detection, TLP, and RTO are |
403 // The handshake alarm is set when the handshake has not completed, and the | 403 // implemented with a single alarm. The handshake alarm is set when the |
404 // TLP and RTO alarms are set after that. | 404 // handshake has not completed, the loss alarm is set when the loss detection |
| 405 // algorithm says to, and the TLP and RTO alarms are set after that. |
405 // The TLP alarm is always set to run for under an RTO. | 406 // The TLP alarm is always set to run for under an RTO. |
406 switch (GetRetransmissionMode()) { | 407 switch (GetRetransmissionMode()) { |
407 case HANDSHAKE_MODE: | 408 case HANDSHAKE_MODE: |
408 ++stats_->crypto_retransmit_count; | 409 ++stats_->crypto_retransmit_count; |
409 RetransmitCryptoPackets(); | 410 RetransmitCryptoPackets(); |
410 return; | 411 return; |
411 case LOSS_MODE: | 412 case LOSS_MODE: |
| 413 ++stats_->loss_timeout_count; |
412 InvokeLossDetection(clock_->Now()); | 414 InvokeLossDetection(clock_->Now()); |
413 return; | 415 return; |
414 case TLP_MODE: | 416 case TLP_MODE: |
415 // If no tail loss probe can be sent, because there are no retransmittable | 417 // If no tail loss probe can be sent, because there are no retransmittable |
416 // packets, execute a conventional RTO to abandon old packets. | 418 // packets, execute a conventional RTO to abandon old packets. |
417 ++stats_->tlp_count; | 419 ++stats_->tlp_count; |
418 RetransmitOldestPacket(); | 420 RetransmitOldestPacket(); |
419 return; | 421 return; |
420 case RTO_MODE: | 422 case RTO_MODE: |
421 ++stats_->rto_count; | 423 ++stats_->rto_count; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 } | 555 } |
554 | 556 |
555 InvokeLossDetection(ack_receive_time); | 557 InvokeLossDetection(ack_receive_time); |
556 } | 558 } |
557 | 559 |
558 void QuicSentPacketManager::InvokeLossDetection(QuicTime time) { | 560 void QuicSentPacketManager::InvokeLossDetection(QuicTime time) { |
559 SequenceNumberSet lost_packets = | 561 SequenceNumberSet lost_packets = |
560 loss_algorithm_->DetectLostPackets(unacked_packets_, | 562 loss_algorithm_->DetectLostPackets(unacked_packets_, |
561 time, | 563 time, |
562 largest_observed_, | 564 largest_observed_, |
563 send_algorithm_->SmoothedRtt()); | 565 send_algorithm_->SmoothedRtt(), |
| 566 rtt_sample_); |
564 for (SequenceNumberSet::const_iterator it = lost_packets.begin(); | 567 for (SequenceNumberSet::const_iterator it = lost_packets.begin(); |
565 it != lost_packets.end(); ++it) { | 568 it != lost_packets.end(); ++it) { |
566 QuicPacketSequenceNumber sequence_number = *it; | 569 QuicPacketSequenceNumber sequence_number = *it; |
567 // TODO(ianswett): If it's expected the FEC packet may repair the loss, it | 570 // TODO(ianswett): If it's expected the FEC packet may repair the loss, it |
568 // should be recorded as a loss to the send algorithm, but not retransmitted | 571 // should be recorded as a loss to the send algorithm, but not retransmitted |
569 // until it's known whether the FEC packet arrived. | 572 // until it's known whether the FEC packet arrived. |
570 ++stats_->packets_lost; | 573 ++stats_->packets_lost; |
571 send_algorithm_->OnPacketLost(sequence_number, time); | 574 send_algorithm_->OnPacketLost(sequence_number, time); |
572 OnPacketAbandoned(sequence_number); | 575 OnPacketAbandoned(sequence_number); |
573 | 576 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 return; | 742 return; |
740 } | 743 } |
741 | 744 |
742 using_pacing_ = true; | 745 using_pacing_ = true; |
743 send_algorithm_.reset( | 746 send_algorithm_.reset( |
744 new PacingSender(send_algorithm_.release(), | 747 new PacingSender(send_algorithm_.release(), |
745 QuicTime::Delta::FromMicroseconds(1))); | 748 QuicTime::Delta::FromMicroseconds(1))); |
746 } | 749 } |
747 | 750 |
748 } // namespace net | 751 } // namespace net |
OLD | NEW |