| 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 QuicPacketNumber newest_transmission = | 470 QuicPacketNumber newest_transmission = |
| 471 GetNewestRetransmission(packet_number, transmission_info); | 471 GetNewestRetransmission(packet_number, transmission_info); |
| 472 // We do not need to retransmit this packet anymore. | 472 // We do not need to retransmit this packet anymore. |
| 473 if (delegate_ != nullptr) { | 473 if (delegate_ != nullptr) { |
| 474 delegate_->OnPacketMarkedNotRetransmittable(path_id_, newest_transmission, | 474 delegate_->OnPacketMarkedNotRetransmittable(path_id_, newest_transmission, |
| 475 ack_delay_time); | 475 ack_delay_time); |
| 476 } else { | 476 } else { |
| 477 pending_retransmissions_.erase(newest_transmission); | 477 pending_retransmissions_.erase(newest_transmission); |
| 478 } | 478 } |
| 479 | 479 |
| 480 // The AckListener needs to be notified for revived packets, | |
| 481 // since it indicates the packet arrived from the appliction's perspective. | |
| 482 unacked_packets_.NotifyAndClearListeners(newest_transmission, ack_delay_time); | 480 unacked_packets_.NotifyAndClearListeners(newest_transmission, ack_delay_time); |
| 483 unacked_packets_.RemoveRetransmittability(packet_number); | 481 unacked_packets_.RemoveRetransmittability(packet_number); |
| 484 } | 482 } |
| 485 | 483 |
| 486 void QuicSentPacketManager::MarkPacketHandled(QuicPacketNumber packet_number, | 484 void QuicSentPacketManager::MarkPacketHandled(QuicPacketNumber packet_number, |
| 487 TransmissionInfo* info, | 485 TransmissionInfo* info, |
| 488 QuicTime::Delta ack_delay_time) { | 486 QuicTime::Delta ack_delay_time) { |
| 489 QuicPacketNumber newest_transmission = | 487 QuicPacketNumber newest_transmission = |
| 490 GetNewestRetransmission(packet_number, *info); | 488 GetNewestRetransmission(packet_number, *info); |
| 491 // Remove the most recent packet, if it is pending retransmission. | 489 // Remove the most recent packet, if it is pending retransmission. |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 if (FLAGS_quic_log_loss_event && debug_delegate_ != nullptr) { | 708 if (FLAGS_quic_log_loss_event && debug_delegate_ != nullptr) { |
| 711 debug_delegate_->OnPacketLoss(pair.first, LOSS_RETRANSMISSION, time); | 709 debug_delegate_->OnPacketLoss(pair.first, LOSS_RETRANSMISSION, time); |
| 712 } | 710 } |
| 713 | 711 |
| 714 // TODO(ianswett): This could be optimized. | 712 // TODO(ianswett): This could be optimized. |
| 715 if (unacked_packets_.HasRetransmittableFrames(pair.first)) { | 713 if (unacked_packets_.HasRetransmittableFrames(pair.first)) { |
| 716 MarkForRetransmission(pair.first, LOSS_RETRANSMISSION); | 714 MarkForRetransmission(pair.first, LOSS_RETRANSMISSION); |
| 717 } else { | 715 } else { |
| 718 // Since we will not retransmit this, we need to remove it from | 716 // Since we will not retransmit this, we need to remove it from |
| 719 // unacked_packets_. This is either the current transmission of | 717 // unacked_packets_. This is either the current transmission of |
| 720 // a packet whose previous transmission has been acked, a packet that | 718 // a packet whose previous transmission has been acked or a packet that |
| 721 // has been TLP retransmitted, or an FEC packet. | 719 // has been TLP retransmitted. |
| 722 unacked_packets_.RemoveFromInFlight(pair.first); | 720 unacked_packets_.RemoveFromInFlight(pair.first); |
| 723 } | 721 } |
| 724 } | 722 } |
| 725 } | 723 } |
| 726 | 724 |
| 727 bool QuicSentPacketManager::MaybeUpdateRTT(const QuicAckFrame& ack_frame, | 725 bool QuicSentPacketManager::MaybeUpdateRTT(const QuicAckFrame& ack_frame, |
| 728 const QuicTime& ack_receive_time) { | 726 const QuicTime& ack_receive_time) { |
| 729 // We rely on ack_delay_time to compute an RTT estimate, so we | 727 // We rely on ack_delay_time to compute an RTT estimate, so we |
| 730 // only update rtt when the largest observed gets acked. | 728 // only update rtt when the largest observed gets acked. |
| 731 // NOTE: If ack is a truncated ack, then the largest observed is in fact | 729 // NOTE: If ack is a truncated ack, then the largest observed is in fact |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( | 957 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( |
| 960 QuicPacketNumber packet_number) { | 958 QuicPacketNumber packet_number) { |
| 961 return unacked_packets_.GetMutableTransmissionInfo(packet_number); | 959 return unacked_packets_.GetMutableTransmissionInfo(packet_number); |
| 962 } | 960 } |
| 963 | 961 |
| 964 void QuicSentPacketManager::RemoveObsoletePackets() { | 962 void QuicSentPacketManager::RemoveObsoletePackets() { |
| 965 unacked_packets_.RemoveObsoletePackets(); | 963 unacked_packets_.RemoveObsoletePackets(); |
| 966 } | 964 } |
| 967 | 965 |
| 968 } // namespace net | 966 } // namespace net |
| OLD | NEW |