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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 return unacked_packets_.GetLeastUnackedSentPacket(); | 513 return unacked_packets_.GetLeastUnackedSentPacket(); |
514 } | 514 } |
515 | 515 |
516 bool QuicSentPacketManager::OnPacketSent( | 516 bool QuicSentPacketManager::OnPacketSent( |
517 QuicPacketSequenceNumber sequence_number, | 517 QuicPacketSequenceNumber sequence_number, |
518 QuicTime sent_time, | 518 QuicTime sent_time, |
519 QuicByteCount bytes, | 519 QuicByteCount bytes, |
520 TransmissionType transmission_type, | 520 TransmissionType transmission_type, |
521 HasRetransmittableData has_retransmittable_data) { | 521 HasRetransmittableData has_retransmittable_data) { |
522 DCHECK_LT(0u, sequence_number); | 522 DCHECK_LT(0u, sequence_number); |
| 523 DCHECK(unacked_packets_.IsUnacked(sequence_number)); |
523 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets."; | 524 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets."; |
524 if (pending_timer_transmission_count_ > 0) { | 525 if (pending_timer_transmission_count_ > 0) { |
525 --pending_timer_transmission_count_; | 526 --pending_timer_transmission_count_; |
526 } | 527 } |
527 // In rare circumstances, the packet could be serialized, sent, and then acked | |
528 // before OnPacketSent is called. | |
529 if (!unacked_packets_.IsUnacked(sequence_number)) { | |
530 return false; | |
531 } | |
532 | 528 |
533 if (unacked_packets_.bytes_in_flight() == 0) { | 529 if (unacked_packets_.bytes_in_flight() == 0) { |
534 // TODO(ianswett): Consider being less aggressive to force a new | 530 // TODO(ianswett): Consider being less aggressive to force a new |
535 // recent_min_rtt, likely by not discarding a relatively new sample. | 531 // recent_min_rtt, likely by not discarding a relatively new sample. |
536 DVLOG(1) << "Sampling a new recent min rtt within 2 samples. currently:" | 532 DVLOG(1) << "Sampling a new recent min rtt within 2 samples. currently:" |
537 << rtt_stats_.recent_min_rtt().ToMilliseconds() << "ms"; | 533 << rtt_stats_.recent_min_rtt().ToMilliseconds() << "ms"; |
538 rtt_stats_.SampleNewRecentMinRtt(kNumMinRttSamplesAfterQuiescence); | 534 rtt_stats_.SampleNewRecentMinRtt(kNumMinRttSamplesAfterQuiescence); |
539 } | 535 } |
540 | 536 |
541 // Only track packets as in flight that the send algorithm wants us to track. | 537 // Only track packets as in flight that the send algorithm wants us to track. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 | 886 |
891 // Set up a pacing sender with a 5 millisecond alarm granularity. | 887 // Set up a pacing sender with a 5 millisecond alarm granularity. |
892 using_pacing_ = true; | 888 using_pacing_ = true; |
893 send_algorithm_.reset( | 889 send_algorithm_.reset( |
894 new PacingSender(send_algorithm_.release(), | 890 new PacingSender(send_algorithm_.release(), |
895 QuicTime::Delta::FromMilliseconds(5), | 891 QuicTime::Delta::FromMilliseconds(5), |
896 kInitialUnpacedBurst)); | 892 kInitialUnpacedBurst)); |
897 } | 893 } |
898 | 894 |
899 } // namespace net | 895 } // namespace net |
OLD | NEW |