ackhandler

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxAckDelay = 25 * time.Millisecond

MaxAckDelay is the maximum time by which we delay sending ACKs.

Variables

This section is empty.

Functions

func HasAckElicitingFrames

func HasAckElicitingFrames(fs []Frame) bool

HasAckElicitingFrames returns true if at least one frame is ack-eliciting.

func IsFrameAckEliciting

func IsFrameAckEliciting(f wire.Frame) bool

IsFrameAckEliciting returns true if the frame is ack-eliciting.

func IsFrameTypeAckEliciting

func IsFrameTypeAckEliciting(t wire.FrameType) bool

IsFrameTypeAckEliciting returns true if the frame is ack-eliciting.

Types

type Frame

type Frame struct {
	Frame   wire.Frame // nil if the frame has already been acknowledged in another packet
	Handler FrameHandler
}

type FrameHandler

type FrameHandler interface {
	OnAcked(wire.Frame)
	OnLost(wire.Frame)
}

FrameHandler handles the acknowledgement and the loss of a frame.

type ReceivedPacketHandler

type ReceivedPacketHandler struct {
	// contains filtered or unexported fields
}

func NewReceivedPacketHandler

func NewReceivedPacketHandler(logger utils.Logger) *ReceivedPacketHandler

func (*ReceivedPacketHandler) DropPackets

func (h *ReceivedPacketHandler) DropPackets(encLevel protocol.EncryptionLevel)

func (*ReceivedPacketHandler) GetAckFrame

func (h *ReceivedPacketHandler) GetAckFrame(encLevel protocol.EncryptionLevel, now monotime.Time, onlyIfQueued bool) *wire.AckFrame

func (*ReceivedPacketHandler) GetAlarmTimeout

func (h *ReceivedPacketHandler) GetAlarmTimeout() monotime.Time

func (*ReceivedPacketHandler) IgnorePacketsBelow

func (h *ReceivedPacketHandler) IgnorePacketsBelow(pn protocol.PacketNumber)

func (*ReceivedPacketHandler) IsPotentiallyDuplicate

func (h *ReceivedPacketHandler) IsPotentiallyDuplicate(pn protocol.PacketNumber, space protocol.PacketNumberSpace) bool

func (*ReceivedPacketHandler) ReceivedPacket

func (h *ReceivedPacketHandler) ReceivedPacket(
	pn protocol.PacketNumber,
	ecn protocol.ECN,
	encLevel protocol.EncryptionLevel,
	rcvTime monotime.Time,
	ackEliciting bool,
) error

func (*ReceivedPacketHandler) SetMaxAckDelay

func (h *ReceivedPacketHandler) SetMaxAckDelay(delay time.Duration)

SetMaxAckDelay configures the advertised bound before packets are received.

type SendMode

type SendMode uint8

The SendMode says what kind of packets can be sent.

const (
	// SendNone means that no packets should be sent
	SendNone SendMode = iota
	// SendAck means an ACK-only packet should be sent
	SendAck
	// SendPTOInitial means that an Initial probe packet should be sent
	SendPTOInitial
	// SendPTOHandshake means that a Handshake probe packet should be sent
	SendPTOHandshake
	// SendPTOAppData means that an Application data probe packet should be sent
	SendPTOAppData
	// SendPacingLimited means that the pacer doesn't allow sending of a packet right now,
	// but will do in a little while.
	// The timestamp when sending is allowed again can be obtained via the SentPacketHandler.TimeUntilSend.
	SendPacingLimited
	// SendAny means that any packet should be sent
	SendAny
)

func (SendMode) String

func (s SendMode) String() string

type SentPacketHandler

type SentPacketHandler interface {
	// SentPacket may modify the packet
	SentPacket(t monotime.Time, pn, largestAcked protocol.PacketNumber, streamFrames []StreamFrame, frames []Frame, encLevel protocol.EncryptionLevel, ecn protocol.ECN, size protocol.ByteCount, isPathMTUProbePacket, isPathProbePacket bool)
	// ReceivedAck processes an ACK frame.
	// It does not store a copy of the frame.
	ReceivedAck(f *wire.AckFrame, encLevel protocol.EncryptionLevel, rcvTime monotime.Time) (bool, error)
	ReceivedPacket(protocol.EncryptionLevel, monotime.Time)
	ReceivedBytes(_ protocol.ByteCount, rcvTime monotime.Time)
	DropPackets(_ protocol.EncryptionLevel, rcvTime monotime.Time)
	ResetForRetry(rcvTime monotime.Time)

	// The SendMode determines if and what kind of packets can be sent.
	SendMode(now monotime.Time) SendMode
	// TimeUntilSend is the time when the next packet should be sent.
	// It is used for pacing packets.
	TimeUntilSend() monotime.Time
	SetMaxDatagramSize(count protocol.ByteCount)

	// only to be called once the handshake is complete
	QueueProbePacket(protocol.PacketNumberSpace) bool /* was a packet queued */

	ECNMode(isShortHeaderPacket bool) protocol.ECN // isShortHeaderPacket should only be true for non-coalesced 1-RTT packets
	PeekPacketNumber(protocol.PacketNumberSpace) (protocol.PacketNumber, protocol.PacketNumberLen)
	PopPacketNumber(protocol.PacketNumberSpace) protocol.PacketNumber

	GetLossDetectionTimeout() monotime.Time
	OnLossDetectionTimeout(now monotime.Time) error

	MigratedPath(now monotime.Time, initialMaxPacketSize protocol.ByteCount)
}

SentPacketHandler handles ACKs received for outgoing packets

func NewSentPacketHandler

func NewSentPacketHandler(
	initialPN protocol.PacketNumber,
	initialMaxDatagramSize protocol.ByteCount,
	rttStats *utils.RTTStats,
	connStats *utils.ConnectionStats,
	clientAddressValidated bool,
	enableECN bool,
	ignorePacketsBelow func(protocol.PacketNumber),
	pers protocol.Perspective,
	qlogger qlogwriter.Recorder,
	logger utils.Logger,
) SentPacketHandler

clientAddressValidated indicates whether the address was validated beforehand by an address validation token. If the address was validated, the amplification limit doesn't apply. It has no effect for a client.

type StreamFrame

type StreamFrame struct {
	Frame   *wire.StreamFrame
	Handler FrameHandler
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL