| 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/core/quic_sent_packet_manager.h" | 5 #include "net/quic/core/quic_sent_packet_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 path_id_(path_id), | 66 path_id_(path_id), |
| 67 clock_(clock), | 67 clock_(clock), |
| 68 stats_(stats), | 68 stats_(stats), |
| 69 delegate_(delegate), | 69 delegate_(delegate), |
| 70 debug_delegate_(nullptr), | 70 debug_delegate_(nullptr), |
| 71 network_change_visitor_(nullptr), | 71 network_change_visitor_(nullptr), |
| 72 initial_congestion_window_(kInitialCongestionWindow), | 72 initial_congestion_window_(kInitialCongestionWindow), |
| 73 loss_algorithm_(&general_loss_algorithm_), | 73 loss_algorithm_(&general_loss_algorithm_), |
| 74 general_loss_algorithm_(loss_type), | 74 general_loss_algorithm_(loss_type), |
| 75 n_connection_simulation_(false), | 75 n_connection_simulation_(false), |
| 76 receive_buffer_bytes_(kDefaultSocketReceiveBuffer), | |
| 77 least_packet_awaited_by_peer_(1), | 76 least_packet_awaited_by_peer_(1), |
| 78 first_rto_transmission_(0), | 77 first_rto_transmission_(0), |
| 79 consecutive_rto_count_(0), | 78 consecutive_rto_count_(0), |
| 80 consecutive_tlp_count_(0), | 79 consecutive_tlp_count_(0), |
| 81 consecutive_crypto_retransmission_count_(0), | 80 consecutive_crypto_retransmission_count_(0), |
| 82 pending_timer_transmission_count_(0), | 81 pending_timer_transmission_count_(0), |
| 83 max_tail_loss_probes_(kDefaultMaxTailLossProbes), | 82 max_tail_loss_probes_(kDefaultMaxTailLossProbes), |
| 84 enable_half_rtt_tail_loss_probe_(false), | 83 enable_half_rtt_tail_loss_probe_(false), |
| 85 using_pacing_(false), | 84 using_pacing_(false), |
| 86 use_new_rto_(false), | 85 use_new_rto_(false), |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 const QuicTransmissionInfo& transmission_info) const { | 490 const QuicTransmissionInfo& transmission_info) const { |
| 492 QuicPacketNumber retransmission = transmission_info.retransmission; | 491 QuicPacketNumber retransmission = transmission_info.retransmission; |
| 493 while (retransmission != 0) { | 492 while (retransmission != 0) { |
| 494 packet_number = retransmission; | 493 packet_number = retransmission; |
| 495 retransmission = | 494 retransmission = |
| 496 unacked_packets_.GetTransmissionInfo(retransmission).retransmission; | 495 unacked_packets_.GetTransmissionInfo(retransmission).retransmission; |
| 497 } | 496 } |
| 498 return packet_number; | 497 return packet_number; |
| 499 } | 498 } |
| 500 | 499 |
| 501 void QuicSentPacketManager::MarkPacketNotRetransmittable( | |
| 502 QuicPacketNumber packet_number, | |
| 503 QuicTime::Delta ack_delay_time) { | |
| 504 if (!unacked_packets_.IsUnacked(packet_number)) { | |
| 505 return; | |
| 506 } | |
| 507 | |
| 508 const QuicTransmissionInfo& transmission_info = | |
| 509 unacked_packets_.GetTransmissionInfo(packet_number); | |
| 510 QuicPacketNumber newest_transmission = | |
| 511 GetNewestRetransmission(packet_number, transmission_info); | |
| 512 // We do not need to retransmit this packet anymore. | |
| 513 if (delegate_ != nullptr) { | |
| 514 delegate_->OnPacketMarkedNotRetransmittable(path_id_, newest_transmission, | |
| 515 ack_delay_time); | |
| 516 } else { | |
| 517 pending_retransmissions_.erase(newest_transmission); | |
| 518 } | |
| 519 | |
| 520 unacked_packets_.NotifyAndClearListeners(newest_transmission, ack_delay_time); | |
| 521 unacked_packets_.RemoveRetransmittability(packet_number); | |
| 522 } | |
| 523 | |
| 524 void QuicSentPacketManager::MarkPacketHandled(QuicPacketNumber packet_number, | 500 void QuicSentPacketManager::MarkPacketHandled(QuicPacketNumber packet_number, |
| 525 QuicTransmissionInfo* info, | 501 QuicTransmissionInfo* info, |
| 526 QuicTime::Delta ack_delay_time) { | 502 QuicTime::Delta ack_delay_time) { |
| 527 QuicPacketNumber newest_transmission = | 503 QuicPacketNumber newest_transmission = |
| 528 GetNewestRetransmission(packet_number, *info); | 504 GetNewestRetransmission(packet_number, *info); |
| 529 // Remove the most recent packet, if it is pending retransmission. | 505 // Remove the most recent packet, if it is pending retransmission. |
| 530 if (delegate_ != nullptr) { | 506 if (delegate_ != nullptr) { |
| 531 delegate_->OnPacketMarkedHandled(path_id_, newest_transmission, | 507 delegate_->OnPacketMarkedHandled(path_id_, newest_transmission, |
| 532 ack_delay_time); | 508 ack_delay_time); |
| 533 } else { | 509 } else { |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 } | 1015 } |
| 1040 | 1016 |
| 1041 size_t QuicSentPacketManager::GetConsecutiveRtoCount() const { | 1017 size_t QuicSentPacketManager::GetConsecutiveRtoCount() const { |
| 1042 return consecutive_rto_count_; | 1018 return consecutive_rto_count_; |
| 1043 } | 1019 } |
| 1044 | 1020 |
| 1045 size_t QuicSentPacketManager::GetConsecutiveTlpCount() const { | 1021 size_t QuicSentPacketManager::GetConsecutiveTlpCount() const { |
| 1046 return consecutive_tlp_count_; | 1022 return consecutive_tlp_count_; |
| 1047 } | 1023 } |
| 1048 | 1024 |
| 1049 QuicTransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( | |
| 1050 QuicPacketNumber packet_number) { | |
| 1051 return unacked_packets_.GetMutableTransmissionInfo(packet_number); | |
| 1052 } | |
| 1053 | |
| 1054 void QuicSentPacketManager::RemoveObsoletePackets() { | |
| 1055 unacked_packets_.RemoveObsoletePackets(); | |
| 1056 } | |
| 1057 | |
| 1058 void QuicSentPacketManager::OnApplicationLimited() { | 1025 void QuicSentPacketManager::OnApplicationLimited() { |
| 1059 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); | 1026 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); |
| 1060 } | 1027 } |
| 1061 | 1028 |
| 1062 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { | 1029 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { |
| 1063 return send_algorithm_.get(); | 1030 return send_algorithm_.get(); |
| 1064 } | 1031 } |
| 1065 | 1032 |
| 1066 } // namespace net | 1033 } // namespace net |
| OLD | NEW |