114 std::chrono::steady_clock::time_point recv_time)
122 -> std::optional<std::chrono::steady_clock::time_point>;
141 [[nodiscard]]
auto pto_count() const noexcept -> uint32_t
238 std::chrono::steady_clock::time_point now)
239 -> std::vector<sent_packet>;
ECN (Explicit Congestion Notification) tracker (RFC 9000 Section 13.4, RFC 9002 Section 7....
QUIC loss detection (RFC 9002 Section 6)
auto has_unacked_packets(encryption_level level) const -> bool
Check if there are any unacked packets in the given space.
bool handshake_confirmed_
True if the handshake is confirmed.
auto set_handshake_confirmed(bool confirmed) noexcept -> void
Set handshake confirmed status.
auto on_timeout() -> loss_detection_result
Handle timeout expiry (RFC 9002 Section 6.2)
auto total_bytes_in_flight() const -> size_t
Get total bytes in flight across all spaces.
auto reset_pto_count() noexcept -> void
Reset PTO count to zero.
auto space_index(encryption_level level) const noexcept -> size_t
Get space index from encryption level.
loss_detector(rtt_estimator &rtt)
Constructor.
std::chrono::steady_clock::time_point loss_detection_timer_
Scheduled loss detection timeout.
auto bytes_in_flight(encryption_level level) const -> size_t
Get bytes in flight for a packet number space.
auto set_loss_detection_timer() -> void
Set loss detection timer (RFC 9002 Section 6.2)
auto pto_count() const noexcept -> uint32_t
Get the current PTO count.
auto discard_space(encryption_level level) -> void
Discard packet number space (e.g., after handshake keys discarded)
auto get_ecn_tracker() const noexcept -> const class ecn_tracker &
Get the ECN tracker (const)
auto on_packet_sent(const sent_packet &packet) -> void
Record a sent packet.
auto get_pto_time_and_space() const -> std::pair< std::chrono::steady_clock::time_point, encryption_level >
Get PTO time and space (RFC 9002 Appendix A.8)
static constexpr auto kGranularity
Timer granularity (RFC 9002 Section 6.1.2)
auto on_ack_received(const ack_frame &ack, encryption_level level, std::chrono::steady_clock::time_point recv_time) -> loss_detection_result
Process received ACK frame (RFC 9002 Section 6)
rtt_estimator & rtt_
Reference to RTT estimator.
class ecn_tracker ecn_tracker_
ECN tracker for ECN feedback processing.
bool timer_armed_
True if loss detection timer is armed.
auto detect_lost_packets(encryption_level level, std::chrono::steady_clock::time_point now) -> std::vector< sent_packet >
Detect lost packets (RFC 9002 Section 6.1)
auto next_timeout() const -> std::optional< std::chrono::steady_clock::time_point >
Get the time of the next scheduled timeout.
static constexpr uint32_t kPacketThreshold
Packet threshold (RFC 9002 Section 6.1.1)
uint32_t pto_count_
Number of times PTO has expired without receiving an ACK.
static constexpr double kTimeThreshold
Time threshold multiplier (RFC 9002 Section 6.1.2)
auto get_loss_time_and_space() const -> std::pair< std::chrono::steady_clock::time_point, encryption_level >
Get loss time and space (RFC 9002 Appendix A.8)
auto get_ecn_tracker() noexcept -> class ecn_tracker &
Get the ECN tracker.
std::array< space_state, 3 > spaces_
Per packet-number-space state (Initial, Handshake, Application)
auto largest_acked(encryption_level level) const noexcept -> uint64_t
Get the largest acknowledged packet number for a space.
QUIC packet number utilities (RFC 9000 Section 17.1)
RTT estimation for QUIC (RFC 9002 Section 5)
encryption_level
QUIC encryption levels (RFC 9001 Section 4)
@ initial
Initial encryption (derived from DCID)
ecn_result
Result of ECN counts processing (RFC 9000 Section 13.4)
@ none
No congestion signal.
loss_detection_event
Events that can occur during loss detection.
@ packet_lost
Packet(s) declared lost.
@ pto_expired
Probe timeout expired.
ACK frame (RFC 9000 Section 19.3)
Result of loss detection operations.
ecn_result ecn_signal
ECN signal from ACK_ECN frame processing.
std::chrono::steady_clock::time_point ecn_congestion_sent_time
Sent time of the packet that triggered ECN congestion signal (used for congestion recovery tracking)
std::vector< sent_packet > acked_packets
Packets that were acknowledged.
std::vector< sent_packet > lost_packets
Packets that were declared lost.
Per packet-number-space state (RFC 9002 Appendix A.1)
bool largest_acked_set
True if we've received any ACK in this space.
std::chrono::steady_clock::time_point loss_time
Time at which loss detection should be triggered.
std::map< uint64_t, sent_packet > sent_packets
Sent packets awaiting acknowledgment.
std::chrono::steady_clock::time_point time_of_last_ack_eliciting
Time of the most recent ack-eliciting packet.
uint64_t largest_acked
Largest acknowledged packet number.
size_t bytes_in_flight
Bytes in flight for this space.
Information about a sent packet for loss detection (RFC 9002 Section A.1.1)
encryption_level level
Encryption level of the packet.
std::chrono::steady_clock::time_point sent_time
Time the packet was sent.
size_t sent_bytes
Number of bytes in the packet.
bool in_flight
True if the packet is in flight (counted for congestion control)
bool ack_eliciting
True if this packet is ack-eliciting.
std::vector< frame > frames
Frames included in this packet (for retransmission)