| 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 "net/quic/chromium/quic_utils_chromium.h" | 10 #include "net/quic/chromium/quic_utils_chromium.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 SetSendAlgorithm(kBBR); | 110 SetSendAlgorithm(kBBR); |
| 111 } | 111 } |
| 112 if (config.HasClientRequestedIndependentOption(kRENO, perspective_)) { | 112 if (config.HasClientRequestedIndependentOption(kRENO, perspective_)) { |
| 113 if (config.HasClientRequestedIndependentOption(kBYTE, perspective_)) { | 113 if (config.HasClientRequestedIndependentOption(kBYTE, perspective_)) { |
| 114 SetSendAlgorithm(kRenoBytes); | 114 SetSendAlgorithm(kRenoBytes); |
| 115 } else { | 115 } else { |
| 116 SetSendAlgorithm(kReno); | 116 SetSendAlgorithm(kReno); |
| 117 } | 117 } |
| 118 } else if (config.HasClientRequestedIndependentOption(kBYTE, perspective_)) { | 118 } else if (config.HasClientRequestedIndependentOption(kBYTE, perspective_)) { |
| 119 SetSendAlgorithm(kCubic); | 119 SetSendAlgorithm(kCubic); |
| 120 } else if (FLAGS_quic_reloadable_flag_quic_default_to_bbr && |
| 121 config.HasClientRequestedIndependentOption(kQBIC, perspective_)) { |
| 122 SetSendAlgorithm(kCubicBytes); |
| 120 } else if (FLAGS_quic_reloadable_flag_quic_enable_pcc && | 123 } else if (FLAGS_quic_reloadable_flag_quic_enable_pcc && |
| 121 config.HasClientRequestedIndependentOption(kTPCC, perspective_)) { | 124 config.HasClientRequestedIndependentOption(kTPCC, perspective_)) { |
| 122 SetSendAlgorithm(kPCC); | 125 SetSendAlgorithm(kPCC); |
| 123 } | 126 } |
| 124 | 127 |
| 125 // The PCCSender implements its own version of pacing through the | 128 // The PCCSender implements its own version of pacing through the |
| 126 // SendAlgorithm::TimeUntilSend() function. Do not wrap a | 129 // SendAlgorithm::TimeUntilSend() function. Do not wrap a |
| 127 // PacingSender around it, since wrapping a PacingSender around an | 130 // PacingSender around it, since wrapping a PacingSender around an |
| 128 // already paced SendAlgorithm produces a DCHECK. TODO(fayang): | 131 // already paced SendAlgorithm produces a DCHECK. TODO(fayang): |
| 129 // Change this if/when the PCCSender uses the PacingSender. | 132 // Change this if/when the PCCSender uses the PacingSender. |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 QuicTransmissionInfo* info, | 460 QuicTransmissionInfo* info, |
| 458 QuicTime::Delta ack_delay_time) { | 461 QuicTime::Delta ack_delay_time) { |
| 459 QuicPacketNumber newest_transmission = | 462 QuicPacketNumber newest_transmission = |
| 460 GetNewestRetransmission(packet_number, *info); | 463 GetNewestRetransmission(packet_number, *info); |
| 461 // Remove the most recent packet, if it is pending retransmission. | 464 // Remove the most recent packet, if it is pending retransmission. |
| 462 pending_retransmissions_.erase(newest_transmission); | 465 pending_retransmissions_.erase(newest_transmission); |
| 463 | 466 |
| 464 // The AckListener needs to be notified about the most recent | 467 // The AckListener needs to be notified about the most recent |
| 465 // transmission, since that's the one only one it tracks. | 468 // transmission, since that's the one only one it tracks. |
| 466 if (newest_transmission == packet_number) { | 469 if (newest_transmission == packet_number) { |
| 470 unacked_packets_.NotifyStreamFramesAcked(*info, ack_delay_time); |
| 467 unacked_packets_.NotifyAndClearListeners(&info->ack_listeners, | 471 unacked_packets_.NotifyAndClearListeners(&info->ack_listeners, |
| 468 ack_delay_time); | 472 ack_delay_time); |
| 469 } else { | 473 } else { |
| 470 unacked_packets_.NotifyAndClearListeners(newest_transmission, | 474 unacked_packets_.NotifyAndClearListeners(newest_transmission, |
| 471 ack_delay_time); | 475 ack_delay_time); |
| 472 RecordSpuriousRetransmissions(*info, packet_number); | 476 RecordSpuriousRetransmissions(*info, packet_number); |
| 473 // Remove the most recent packet from flight if it's a crypto handshake | 477 // Remove the most recent packet from flight if it's a crypto handshake |
| 474 // packet, since they won't be acked now that one has been processed. | 478 // packet, since they won't be acked now that one has been processed. |
| 475 // Other crypto handshake packets won't be in flight, only the newest | 479 // Other crypto handshake packets won't be in flight, only the newest |
| 476 // transmission of a crypto packet is in flight at once. | 480 // transmission of a crypto packet is in flight at once. |
| 477 // TODO(ianswett): Instead of handling all crypto packets special, | 481 // TODO(ianswett): Instead of handling all crypto packets special, |
| 478 // only handle nullptr encrypted packets in a special way. | 482 // only handle nullptr encrypted packets in a special way. |
| 479 const QuicTransmissionInfo& newest_transmission_info = | 483 const QuicTransmissionInfo& newest_transmission_info = |
| 480 unacked_packets_.GetTransmissionInfo(newest_transmission); | 484 unacked_packets_.GetTransmissionInfo(newest_transmission); |
| 485 unacked_packets_.NotifyStreamFramesAcked(newest_transmission_info, |
| 486 ack_delay_time); |
| 481 if (HasCryptoHandshake(newest_transmission_info)) { | 487 if (HasCryptoHandshake(newest_transmission_info)) { |
| 482 unacked_packets_.RemoveFromInFlight(newest_transmission); | 488 unacked_packets_.RemoveFromInFlight(newest_transmission); |
| 483 } | 489 } |
| 484 } | 490 } |
| 485 | 491 |
| 486 if (network_change_visitor_ != nullptr && | 492 if (network_change_visitor_ != nullptr && |
| 487 info->bytes_sent > largest_mtu_acked_) { | 493 info->bytes_sent > largest_mtu_acked_) { |
| 488 largest_mtu_acked_ = info->bytes_sent; | 494 largest_mtu_acked_ = info->bytes_sent; |
| 489 network_change_visitor_->OnPathMtuIncreased(largest_mtu_acked_); | 495 network_change_visitor_->OnPathMtuIncreased(largest_mtu_acked_); |
| 490 } | 496 } |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 } | 961 } |
| 956 | 962 |
| 957 void QuicSentPacketManager::OnApplicationLimited() { | 963 void QuicSentPacketManager::OnApplicationLimited() { |
| 958 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); | 964 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); |
| 959 } | 965 } |
| 960 | 966 |
| 961 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { | 967 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { |
| 962 return send_algorithm_.get(); | 968 return send_algorithm_.get(); |
| 963 } | 969 } |
| 964 | 970 |
| 971 void QuicSentPacketManager::SetStreamNotifier( |
| 972 StreamNotifierInterface* stream_notifier) { |
| 973 unacked_packets_.SetStreamNotifier(stream_notifier); |
| 974 } |
| 975 |
| 965 } // namespace net | 976 } // namespace net |
| OLD | NEW |