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" |
11 #include "net/quic/congestion_control/pacing_sender.h" | 11 #include "net/quic/congestion_control/pacing_sender.h" |
12 #include "net/quic/crypto/crypto_protocol.h" | 12 #include "net/quic/crypto/crypto_protocol.h" |
13 #include "net/quic/proto/cached_network_parameters.pb.h" | 13 #include "net/quic/proto/cached_network_parameters.pb.h" |
| 14 #include "net/quic/quic_bug_tracker.h" |
14 #include "net/quic/quic_connection_stats.h" | 15 #include "net/quic/quic_connection_stats.h" |
15 #include "net/quic/quic_flags.h" | 16 #include "net/quic/quic_flags.h" |
16 #include "net/quic/quic_utils_chromium.h" | 17 #include "net/quic/quic_utils_chromium.h" |
17 | 18 |
18 using std::max; | 19 using std::max; |
19 using std::min; | 20 using std::min; |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 | 23 |
23 // The length of the recent min rtt window in seconds. Windowing is disabled for | 24 // The length of the recent min rtt window in seconds. Windowing is disabled for |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 416 } |
416 return; | 417 return; |
417 } | 418 } |
418 const PacketNumberList* all_transmissions = info.all_transmissions; | 419 const PacketNumberList* all_transmissions = info.all_transmissions; |
419 for (PacketNumberList::const_reverse_iterator it = | 420 for (PacketNumberList::const_reverse_iterator it = |
420 all_transmissions->rbegin(); | 421 all_transmissions->rbegin(); |
421 it != all_transmissions->rend() && *it > acked_packet_number; ++it) { | 422 it != all_transmissions->rend() && *it > acked_packet_number; ++it) { |
422 // ianswett: Prevents crash in b/20552846. | 423 // ianswett: Prevents crash in b/20552846. |
423 if (*it < unacked_packets_.GetLeastUnacked() || | 424 if (*it < unacked_packets_.GetLeastUnacked() || |
424 *it > unacked_packets_.largest_sent_packet()) { | 425 *it > unacked_packets_.largest_sent_packet()) { |
425 LOG(DFATAL) << "Retransmission out of range:" << *it | 426 QUIC_BUG << "Retransmission out of range:" << *it |
426 << " least unacked:" << unacked_packets_.GetLeastUnacked() | 427 << " least unacked:" << unacked_packets_.GetLeastUnacked() |
427 << " largest sent:" << unacked_packets_.largest_sent_packet(); | 428 << " largest sent:" << unacked_packets_.largest_sent_packet(); |
428 return; | 429 return; |
429 } | 430 } |
430 const TransmissionInfo& retransmit_info = | 431 const TransmissionInfo& retransmit_info = |
431 unacked_packets_.GetTransmissionInfo(*it); | 432 unacked_packets_.GetTransmissionInfo(*it); |
432 | 433 |
433 RecordOneSpuriousRetransmission(retransmit_info); | 434 RecordOneSpuriousRetransmission(retransmit_info); |
434 } | 435 } |
435 } | 436 } |
436 | 437 |
437 bool QuicSentPacketManager::HasPendingRetransmissions() const { | 438 bool QuicSentPacketManager::HasPendingRetransmissions() const { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 QuicByteCount bytes, | 563 QuicByteCount bytes, |
563 TransmissionType transmission_type, | 564 TransmissionType transmission_type, |
564 HasRetransmittableData has_retransmittable_data) { | 565 HasRetransmittableData has_retransmittable_data) { |
565 QuicPacketNumber packet_number = serialized_packet->packet_number; | 566 QuicPacketNumber packet_number = serialized_packet->packet_number; |
566 DCHECK_LT(0u, packet_number); | 567 DCHECK_LT(0u, packet_number); |
567 DCHECK(!unacked_packets_.IsUnacked(packet_number)); | 568 DCHECK(!unacked_packets_.IsUnacked(packet_number)); |
568 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets."; | 569 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets."; |
569 | 570 |
570 if (original_packet_number != 0) { | 571 if (original_packet_number != 0) { |
571 if (!pending_retransmissions_.erase(original_packet_number)) { | 572 if (!pending_retransmissions_.erase(original_packet_number)) { |
572 DLOG(DFATAL) << "Expected packet number to be in " | 573 QUIC_BUG << "Expected packet number to be in " |
573 << "pending_retransmissions_. packet_number: " | 574 << "pending_retransmissions_. packet_number: " |
574 << original_packet_number; | 575 << original_packet_number; |
575 } | 576 } |
576 } | 577 } |
577 | 578 |
578 if (pending_timer_transmission_count_ > 0) { | 579 if (pending_timer_transmission_count_ > 0) { |
579 --pending_timer_transmission_count_; | 580 --pending_timer_transmission_count_; |
580 } | 581 } |
581 | 582 |
582 // Only track packets as in flight that the send algorithm wants us to track. | 583 // Only track packets as in flight that the send algorithm wants us to track. |
583 // Since FEC packets should also be counted towards the congestion window, | 584 // Since FEC packets should also be counted towards the congestion window, |
584 // consider them as retransmittable for the purposes of congestion control. | 585 // consider them as retransmittable for the purposes of congestion control. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 // unacked, and may cause an RTT sample to be taken. | 781 // unacked, and may cause an RTT sample to be taken. |
781 if (!unacked_packets_.IsUnacked(ack_frame.largest_observed)) { | 782 if (!unacked_packets_.IsUnacked(ack_frame.largest_observed)) { |
782 return false; | 783 return false; |
783 } | 784 } |
784 // We calculate the RTT based on the highest ACKed packet number, the lower | 785 // We calculate the RTT based on the highest ACKed packet number, the lower |
785 // packet numbers will include the ACK aggregation delay. | 786 // packet numbers will include the ACK aggregation delay. |
786 const TransmissionInfo& transmission_info = | 787 const TransmissionInfo& transmission_info = |
787 unacked_packets_.GetTransmissionInfo(ack_frame.largest_observed); | 788 unacked_packets_.GetTransmissionInfo(ack_frame.largest_observed); |
788 // Ensure the packet has a valid sent time. | 789 // Ensure the packet has a valid sent time. |
789 if (transmission_info.sent_time == QuicTime::Zero()) { | 790 if (transmission_info.sent_time == QuicTime::Zero()) { |
790 LOG(DFATAL) << "Acked packet has zero sent time, largest_observed:" | 791 QUIC_BUG << "Acked packet has zero sent time, largest_observed:" |
791 << ack_frame.largest_observed; | 792 << ack_frame.largest_observed; |
792 return false; | 793 return false; |
793 } | 794 } |
794 | 795 |
795 QuicTime::Delta send_delta = | 796 QuicTime::Delta send_delta = |
796 ack_receive_time.Subtract(transmission_info.sent_time); | 797 ack_receive_time.Subtract(transmission_info.sent_time); |
797 rtt_stats_.UpdateRtt(send_delta, ack_frame.delta_time_largest_observed, | 798 rtt_stats_.UpdateRtt(send_delta, ack_frame.delta_time_largest_observed, |
798 ack_receive_time); | 799 ack_receive_time); |
799 | 800 |
800 if (network_change_visitor_ != nullptr) { | 801 if (network_change_visitor_ != nullptr) { |
801 network_change_visitor_->OnRttChange(); | 802 network_change_visitor_->OnRttChange(); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 // Rtt and cwnd do not need to be reset when the peer address change is | 996 // Rtt and cwnd do not need to be reset when the peer address change is |
996 // considered to be caused by NATs. | 997 // considered to be caused by NATs. |
997 return; | 998 return; |
998 } | 999 } |
999 | 1000 |
1000 rtt_stats_.OnConnectionMigration(); | 1001 rtt_stats_.OnConnectionMigration(); |
1001 send_algorithm_->OnConnectionMigration(); | 1002 send_algorithm_->OnConnectionMigration(); |
1002 } | 1003 } |
1003 | 1004 |
1004 } // namespace net | 1005 } // namespace net |
OLD | NEW |