#include "quiche/quic/core/quic_sent_packet_manager.h"
#include <algorithm>
#include <cstddef>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "quiche/quic/core/congestion_control/general_loss_algorithm.h"
#include "quiche/quic/core/congestion_control/pacing_sender.h"
#include "quiche/quic/core/congestion_control/send_algorithm_interface.h"
#include "quiche/quic/core/crypto/crypto_protocol.h"
#include "quiche/quic/core/frames/quic_ack_frequency_frame.h"
#include "quiche/quic/core/proto/cached_network_parameters_proto.h"
#include "quiche/quic/core/quic_connection_stats.h"
#include "quiche/quic/core/quic_constants.h"
#include "quiche/quic/core/quic_packet_number.h"
#include "quiche/quic/core/quic_transmission_info.h"
#include "quiche/quic/core/quic_types.h"
#include "quiche/quic/core/quic_utils.h"
#include "quiche/quic/platform/api/quic_bug_tracker.h"
#include "quiche/quic/platform/api/quic_flag_utils.h"
#include "quiche/quic/platform/api/quic_flags.h"
#include "quiche/quic/platform/api/quic_logging.h"
#include "quiche/common/print_elements.h"
namespace quic {
namespace {
static const int64_t kDefaultRetransmissionTimeMs = …;
static const int64_t kMinHandshakeTimeoutMs = …;
static const size_t kDefaultMaxTailLossProbes = …;
static const float kPtoMultiplierWithoutRttSamples = …;
inline bool ShouldForceRetransmission(TransmissionType transmission_type) { … }
static const uint32_t kConservativeUnpacedBurst = …;
static const uint32_t kNumProbeTimeoutsForPathDegradingDelay = …;
}
#define ENDPOINT …
QuicSentPacketManager::QuicSentPacketManager(
Perspective perspective, const QuicClock* clock, QuicRandom* random,
QuicConnectionStats* stats, CongestionControlType congestion_control_type)
: … { … }
QuicSentPacketManager::~QuicSentPacketManager() { … }
void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { … }
void QuicSentPacketManager::ApplyConnectionOptions(
const QuicTagVector& connection_options) { … }
void QuicSentPacketManager::ResumeConnectionState(
const CachedNetworkParameters& cached_network_params,
bool max_bandwidth_resumption) { … }
void QuicSentPacketManager::AdjustNetworkParameters(
const SendAlgorithmInterface::NetworkParams& params) { … }
void QuicSentPacketManager::SetLossDetectionTuner(
std::unique_ptr<LossDetectionTunerInterface> tuner) { … }
void QuicSentPacketManager::OnConfigNegotiated() { … }
void QuicSentPacketManager::OnConnectionClosed() { … }
void QuicSentPacketManager::SetHandshakeConfirmed() { … }
void QuicSentPacketManager::PostProcessNewlyAckedPackets(
QuicPacketNumber ack_packet_number, EncryptionLevel ack_decrypted_level,
const QuicAckFrame& ack_frame, QuicTime ack_receive_time, bool rtt_updated,
QuicByteCount prior_bytes_in_flight,
std::optional<QuicEcnCounts> ecn_counts) { … }
void QuicSentPacketManager::MaybeInvokeCongestionEvent(
bool rtt_updated, QuicByteCount prior_in_flight, QuicTime event_time,
std::optional<QuicEcnCounts> ecn_counts,
const QuicEcnCounts& previous_counts) { … }
void QuicSentPacketManager::MarkInitialPacketsForRetransmission() { … }
void QuicSentPacketManager::MarkZeroRttPacketsForRetransmission() { … }
void QuicSentPacketManager::NeuterUnencryptedPackets() { … }
void QuicSentPacketManager::NeuterHandshakePackets() { … }
bool QuicSentPacketManager::ShouldAddMaxAckDelay(
PacketNumberSpace space) const { … }
QuicTime QuicSentPacketManager::GetEarliestPacketSentTimeForPto(
PacketNumberSpace* packet_number_space) const { … }
void QuicSentPacketManager::MarkForRetransmission(
QuicPacketNumber packet_number, TransmissionType transmission_type) { … }
void QuicSentPacketManager::RecordOneSpuriousRetransmission(
const QuicTransmissionInfo& info) { … }
void QuicSentPacketManager::MarkPacketHandled(QuicPacketNumber packet_number,
QuicTransmissionInfo* info,
QuicTime ack_receive_time,
QuicTime::Delta ack_delay_time,
QuicTime receive_timestamp) { … }
bool QuicSentPacketManager::CanSendAckFrequency() const { … }
QuicAckFrequencyFrame QuicSentPacketManager::GetUpdatedAckFrequencyFrame()
const { … }
void QuicSentPacketManager::RecordEcnMarkingSent(QuicEcnCodepoint ecn_codepoint,
EncryptionLevel level) { … }
bool QuicSentPacketManager::OnPacketSent(
SerializedPacket* mutable_packet, QuicTime sent_time,
TransmissionType transmission_type,
HasRetransmittableData has_retransmittable_data, bool measure_rtt,
QuicEcnCodepoint ecn_codepoint) { … }
const QuicTransmissionInfo& QuicSentPacketManager::AddDispatcherSentPacket(
const DispatcherSentPacket& packet) { … }
QuicSentPacketManager::RetransmissionTimeoutMode
QuicSentPacketManager::OnRetransmissionTimeout() { … }
void QuicSentPacketManager::RetransmitCryptoPackets() { … }
bool QuicSentPacketManager::MaybeRetransmitOldestPacket(TransmissionType type) { … }
void QuicSentPacketManager::MaybeSendProbePacket() { … }
void QuicSentPacketManager::EnableIetfPtoAndLossDetection() { … }
void QuicSentPacketManager::RetransmitDataOfSpaceIfAny(
PacketNumberSpace space) { … }
QuicSentPacketManager::RetransmissionTimeoutMode
QuicSentPacketManager::GetRetransmissionMode() const { … }
void QuicSentPacketManager::InvokeLossDetection(QuicTime time) { … }
bool QuicSentPacketManager::MaybeUpdateRTT(QuicPacketNumber largest_acked,
QuicTime::Delta ack_delay_time,
QuicTime ack_receive_time) { … }
QuicTime::Delta QuicSentPacketManager::TimeUntilSend(QuicTime now) const { … }
const QuicTime QuicSentPacketManager::GetRetransmissionTime() const { … }
const QuicTime::Delta QuicSentPacketManager::GetPathDegradingDelay() const { … }
const QuicTime::Delta QuicSentPacketManager::GetNetworkBlackholeDelay(
int8_t num_rtos_for_blackhole_detection) const { … }
QuicTime::Delta QuicSentPacketManager::GetMtuReductionDelay(
int8_t num_rtos_for_blackhole_detection) const { … }
const QuicTime::Delta QuicSentPacketManager::GetCryptoRetransmissionDelay()
const { … }
const QuicTime::Delta QuicSentPacketManager::GetProbeTimeoutDelay(
PacketNumberSpace space) const { … }
QuicTime::Delta QuicSentPacketManager::GetSlowStartDuration() const { … }
QuicByteCount QuicSentPacketManager::GetAvailableCongestionWindowInBytes()
const { … }
std::string QuicSentPacketManager::GetDebugState() const { … }
void QuicSentPacketManager::SetSendAlgorithm(
CongestionControlType congestion_control_type) { … }
void QuicSentPacketManager::SetSendAlgorithm(
SendAlgorithmInterface* send_algorithm) { … }
std::unique_ptr<SendAlgorithmInterface>
QuicSentPacketManager::OnConnectionMigration(bool reset_send_algorithm) { … }
void QuicSentPacketManager::OnAckFrameStart(QuicPacketNumber largest_acked,
QuicTime::Delta ack_delay_time,
QuicTime ack_receive_time) { … }
void QuicSentPacketManager::OnAckRange(QuicPacketNumber start,
QuicPacketNumber end) { … }
void QuicSentPacketManager::OnAckTimestamp(QuicPacketNumber packet_number,
QuicTime timestamp) { … }
bool QuicSentPacketManager::IsEcnFeedbackValid(
PacketNumberSpace space, const std::optional<QuicEcnCounts>& ecn_counts,
QuicPacketCount newly_acked_ect0, QuicPacketCount newly_acked_ect1) { … }
AckResult QuicSentPacketManager::OnAckFrameEnd(
QuicTime ack_receive_time, QuicPacketNumber ack_packet_number,
EncryptionLevel ack_decrypted_level,
const std::optional<QuicEcnCounts>& ecn_counts) { … }
void QuicSentPacketManager::SetDebugDelegate(DebugDelegate* debug_delegate) { … }
void QuicSentPacketManager::OnApplicationLimited() { … }
NextReleaseTimeResult QuicSentPacketManager::GetNextReleaseTime() const { … }
void QuicSentPacketManager::SetInitialRtt(QuicTime::Delta rtt, bool trusted) { … }
void QuicSentPacketManager::EnableMultiplePacketNumberSpacesSupport() { … }
QuicPacketNumber QuicSentPacketManager::GetLargestAckedPacket(
EncryptionLevel decrypted_packet_level) const { … }
QuicPacketNumber QuicSentPacketManager::GetLeastPacketAwaitedByPeer(
EncryptionLevel encryption_level) const { … }
QuicPacketNumber QuicSentPacketManager::GetLargestPacketPeerKnowsIsAcked(
EncryptionLevel decrypted_packet_level) const { … }
QuicTime::Delta
QuicSentPacketManager::GetNConsecutiveRetransmissionTimeoutDelay(
int num_timeouts) const { … }
bool QuicSentPacketManager::PeerCompletedAddressValidation() const { … }
bool QuicSentPacketManager::IsLessThanThreePTOs(QuicTime::Delta timeout) const { … }
QuicTime::Delta QuicSentPacketManager::GetPtoDelay() const { … }
void QuicSentPacketManager::OnAckFrequencyFrameSent(
const QuicAckFrequencyFrame& ack_frequency_frame) { … }
void QuicSentPacketManager::OnAckFrequencyFrameAcked(
const QuicAckFrequencyFrame& ack_frequency_frame) { … }
#undef ENDPOINT
}