66 [[nodiscard]]
auto can_send(
size_t bytes = 0)
const noexcept -> bool;
86 std::chrono::steady_clock::time_point ack_time) -> void;
125 [[nodiscard]]
auto cwnd() const noexcept ->
size_t
134 [[nodiscard]]
auto ssthresh() const noexcept ->
size_t
175 auto reset() -> void;
183 std::chrono::steady_clock::time_point sent_time)
const noexcept -> bool;
QUIC congestion control (RFC 9002 Section 7)
congestion_state state_
Current congestion state.
auto on_packet_acked(const sent_packet &packet, std::chrono::steady_clock::time_point ack_time) -> void
Handle packet acknowledgment (RFC 9002 Section 7.3)
auto set_max_datagram_size(size_t size) -> void
Set max datagram size.
auto on_packet_lost(const sent_packet &packet) -> void
Handle packet loss (RFC 9002 Section 7.3.2)
auto on_congestion_event(std::chrono::steady_clock::time_point sent_time) -> void
Handle congestion event (RFC 9002 Section 7.3.2)
auto on_persistent_congestion(const rtt_estimator &rtt) -> void
Handle persistent congestion detection (RFC 9002 Section 7.6)
auto ssthresh() const noexcept -> size_t
Get slow start threshold.
congestion_controller()
Default constructor.
auto can_send(size_t bytes=0) const noexcept -> bool
Check if we can send more data.
static constexpr size_t kDefaultMaxDatagramSize
Default max datagram size (QUIC minimum guaranteed MTU)
auto bytes_in_flight() const noexcept -> size_t
Get bytes in flight.
auto available_window() const noexcept -> size_t
Get available congestion window.
auto on_packet_sent(size_t bytes) -> void
Record bytes sent.
auto max_datagram_size() const noexcept -> size_t
Get max datagram size.
static constexpr size_t kMinimumWindowPackets
Minimum window in packets.
auto state() const noexcept -> congestion_state
Get current congestion state.
size_t minimum_window_
Minimum window size.
static constexpr double kLossReductionFactor
Loss reduction factor (RFC 9002 Section 7.3.2)
size_t bytes_in_flight_
Bytes currently in flight.
size_t ssthresh_
Slow start threshold.
auto cwnd() const noexcept -> size_t
Get current congestion window.
auto reset() -> void
Reset congestion controller to initial state.
auto on_ecn_congestion(std::chrono::steady_clock::time_point sent_time) -> void
Handle ECN congestion signal (RFC 9002 Section 7.1)
size_t max_datagram_size_
Maximum datagram size.
auto is_in_recovery(std::chrono::steady_clock::time_point sent_time) const noexcept -> bool
Check if currently in recovery period.
static constexpr size_t kInitialWindowPackets
Number of datagrams for initial window.
size_t cwnd_
Congestion window in bytes.
size_t initial_window_
Initial window size (for reset)
std::chrono::steady_clock::time_point congestion_recovery_start_
Start of the current congestion recovery period.
RTT estimation for QUIC (RFC 9002 Section 5)
congestion_state
States of the congestion controller (RFC 9002 Section 7)
@ slow_start
Exponential growth of cwnd.
@ recovery
Congestion recovery after loss.
@ congestion_avoidance
Linear growth of cwnd.
auto congestion_state_to_string(congestion_state state) noexcept -> const char *
Convert congestion state to string.
Information about a sent packet for loss detection (RFC 9002 Section A.1.1)