package congestion
Import Path
github.com/quic-go/quic-go/internal/congestion (on go.dev)
Dependency Relation
imports 8 packages, and imported by one package
Involved Source Files
bandwidth.go
clock.go
cubic.go
cubic_sender.go
hybrid_slow_start.go
interface.go
pacer.go
Package-Level Type Names (total 7)
Bandwidth of a connection
func BandwidthFromDelta(bytes protocol.ByteCount, delta time.Duration) Bandwidth
const BitsPerSecond
const BytesPerSecond
A Clock returns the current time
( Clock) Now() monotime.Time
DefaultClock
func NewCubic(clock Clock) *Cubic
func NewCubicSender(clock Clock, rttStats *utils.RTTStats, connStats *utils.ConnectionStats, initialMaxDatagramSize protocol.ByteCount, reno bool, qlogger qlogwriter.Recorder) *cubicSender
Cubic implements the cubic algorithm from TCP
CongestionWindowAfterAck computes a new congestion window to use after a received ACK.
Returns the new congestion window in packets. The new congestion window
follows a cubic function that depends on the time passed since last
packet loss.
CongestionWindowAfterPacketLoss computes a new congestion window to use after
a loss event. Returns the new congestion window in packets. The new
congestion window is a multiplicative decrease of our current window.
OnApplicationLimited is called on ack arrival when sender is unable to use
the available congestion window. Resets Cubic state during quiescence.
Reset is called after a timeout to reset the cubic state
SetNumConnections sets the number of emulated connections
func NewCubic(clock Clock) *Cubic
DefaultClock implements the Clock interface using the Go stdlib clock.
Now gets the current time
DefaultClock : Clock
HybridSlowStart implements the TCP hybrid slow start algorithm
IsEndOfRound returns true if this ack is the last packet number of our current slow start round.
OnPacketAcked gets invoked after ShouldExitSlowStart, so it's best to end
the round when the final packet of the burst is received and start it on
the next incoming ack.
OnPacketSent is called when a packet was sent
Restart the slow start phase
ShouldExitSlowStart should be called on every new ack frame, since a new
RTT measurement can be made then.
rtt: the RTT for this ack packet.
minRTT: is the lowest delay (RTT) we have seen during the session.
congestionWindow: the congestion window in packets.
StartReceiveRound is called for the start of each receive round (burst) in the slow start phase.
Started returns true if started
A SendAlgorithm performs congestion control
( SendAlgorithm) CanSend(bytesInFlight protocol.ByteCount) bool
( SendAlgorithm) HasPacingBudget(now monotime.Time) bool
( SendAlgorithm) MaybeExitSlowStart()
( SendAlgorithm) OnCongestionEvent(number protocol.PacketNumber, lostBytes protocol.ByteCount, priorInFlight protocol.ByteCount)
( SendAlgorithm) OnPacketAcked(number protocol.PacketNumber, ackedBytes protocol.ByteCount, priorInFlight protocol.ByteCount, eventTime monotime.Time)
( SendAlgorithm) OnPacketSent(sentTime monotime.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool)
( SendAlgorithm) OnRetransmissionTimeout(packetsRetransmitted bool)
( SendAlgorithm) SetMaxDatagramSize(protocol.ByteCount)
( SendAlgorithm) TimeUntilSend(bytesInFlight protocol.ByteCount) monotime.Time
SendAlgorithmWithDebugInfos (interface)
A SendAlgorithmWithDebugInfos is a SendAlgorithm that exposes some debug infos
( SendAlgorithmWithDebugInfos) CanSend(bytesInFlight protocol.ByteCount) bool
( SendAlgorithmWithDebugInfos) GetCongestionWindow() protocol.ByteCount
( SendAlgorithmWithDebugInfos) HasPacingBudget(now monotime.Time) bool
( SendAlgorithmWithDebugInfos) InRecovery() bool
( SendAlgorithmWithDebugInfos) InSlowStart() bool
( SendAlgorithmWithDebugInfos) MaybeExitSlowStart()
( SendAlgorithmWithDebugInfos) OnCongestionEvent(number protocol.PacketNumber, lostBytes protocol.ByteCount, priorInFlight protocol.ByteCount)
( SendAlgorithmWithDebugInfos) OnPacketAcked(number protocol.PacketNumber, ackedBytes protocol.ByteCount, priorInFlight protocol.ByteCount, eventTime monotime.Time)
( SendAlgorithmWithDebugInfos) OnPacketSent(sentTime monotime.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool)
( SendAlgorithmWithDebugInfos) OnRetransmissionTimeout(packetsRetransmitted bool)
( SendAlgorithmWithDebugInfos) SetMaxDatagramSize(protocol.ByteCount)
( SendAlgorithmWithDebugInfos) TimeUntilSend(bytesInFlight protocol.ByteCount) monotime.Time
SendAlgorithmWithDebugInfos : SendAlgorithm
Package-Level Functions (total 3)
BandwidthFromDelta calculates the bandwidth from a number of bytes and a time delta
NewCubic returns a new Cubic instance
NewCubicSender makes a new cubic sender
Package-Level Constants (total 2)
BitsPerSecond is 1 bit per second
BytesPerSecond is 1 byte per second
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |