ackhandler

package
v0.0.0-...-73843b2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const EWMAFactor = 0.5

Variables

View Source
var (
	// ErrDuplicateOrOutOfOrderAck occurs when a duplicate or an out-of-order ACK is received
	ErrDuplicateOrOutOfOrderAck = errors.New("SentPacketHandler: Duplicate or out-of-order ACK")
	// ErrTooManyTrackedSentPackets occurs when the sentPacketHandler has to keep track of too many packets
	ErrTooManyTrackedSentPackets = errors.New("Too many outstanding non-acked and non-retransmitted packets")
	// ErrAckForSkippedPacket occurs when the client sent an ACK for a packet number that we intentionally skipped
	ErrAckForSkippedPacket = qerr.Error(qerr.InvalidAckData, "Received an ACK for a skipped packet number")
)

Functions

func AddBandwidthArray

func AddBandwidthArray(newBandwidth float64)

func AddRttArray

func AddRttArray(newSmoothRTT float64)

func CwndToBandwidthMbps

func CwndToBandwidthMbps(cwndBytes float64, timeSeconds float64) float64

func DisplayDeadlineInfo

func DisplayDeadlineInfo(pathID protocol.PathID, bandwidth float64, deadlineRatio float32)

func DisplayInformation

func DisplayInformation(pathID protocol.PathID, rtt, bandwidth float64)

func DurationToMilliseconds

func DurationToMilliseconds(d time.Duration) float64

func HasRetransmittableFrames

func HasRetransmittableFrames(fs []wire.Frame) bool

HasRetransmittableFrames returns true if at least one frame is retransmittable.

func IsFrameRetransmittable

func IsFrameRetransmittable(f wire.Frame) bool

IsFrameRetransmittable returns true if the frame should be retransmitted.

Types

type BanditInformation

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

func NewBanditInformation

func NewBanditInformation() BanditInformation

NewBanditInformation creates a new BanditInformation

type ChangePointDetectionHandler

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

type Packet

type Packet struct {
	PacketNumber    protocol.PacketNumber
	Frames          []wire.Frame
	Length          protocol.ByteCount
	EncryptionLevel protocol.EncryptionLevel

	SendTime time.Time
	Deadline time.Time
}

A Packet is a packet +gen linkedlist

func (*Packet) GetFramesForRetransmission

func (p *Packet) GetFramesForRetransmission() []wire.Frame

GetFramesForRetransmission gets all the frames for retransmission

func (*Packet) IsRetransmittable

func (p *Packet) IsRetransmittable() bool

type PacketElement

type PacketElement struct {

	// The value stored with this element.
	Value Packet
	// contains filtered or unexported fields
}

PacketElement is an element of a linked list.

func (*PacketElement) Next

func (e *PacketElement) Next() *PacketElement

Next returns the next list element or nil.

func (*PacketElement) Prev

func (e *PacketElement) Prev() *PacketElement

Prev returns the previous list element or nil.

type PacketList

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

PacketList represents a doubly linked list. The zero value for PacketList is an empty list ready to use.

func NewPacketList

func NewPacketList() *PacketList

NewPacketList returns an initialized list.

func (*PacketList) Back

func (l *PacketList) Back() *PacketElement

Back returns the last element of list l or nil.

func (*PacketList) Front

func (l *PacketList) Front() *PacketElement

Front returns the first element of list l or nil.

func (*PacketList) Init

func (l *PacketList) Init() *PacketList

Init initializes or clears list l.

func (*PacketList) InsertAfter

func (l *PacketList) InsertAfter(v Packet, mark *PacketElement) *PacketElement

InsertAfter inserts a new element e with value v immediately after mark and returns e. If mark is not an element of l, the list is not modified.

func (*PacketList) InsertBefore

func (l *PacketList) InsertBefore(v Packet, mark *PacketElement) *PacketElement

InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of l, the list is not modified.

func (*PacketList) Len

func (l *PacketList) Len() int

Len returns the number of elements of list l. The complexity is O(1).

func (*PacketList) MoveAfter

func (l *PacketList) MoveAfter(e, mark *PacketElement)

MoveAfter moves element e to its new position after mark. If e is not an element of l, or e == mark, the list is not modified.

func (*PacketList) MoveBefore

func (l *PacketList) MoveBefore(e, mark *PacketElement)

MoveBefore moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified.

func (*PacketList) MoveToBack

func (l *PacketList) MoveToBack(e *PacketElement)

MoveToBack moves element e to the back of list l. If e is not an element of l, the list is not modified.

func (*PacketList) MoveToFront

func (l *PacketList) MoveToFront(e *PacketElement)

MoveToFront moves element e to the front of list l. If e is not an element of l, the list is not modified.

func (*PacketList) PushBack

func (l *PacketList) PushBack(v Packet) *PacketElement

PushBack inserts a new element e with value v at the back of list l and returns e.

func (*PacketList) PushBackList

func (l *PacketList) PushBackList(other *PacketList)

PushBackList inserts a copy of an other list at the back of list l. The lists l and other may be the same.

func (*PacketList) PushFront

func (l *PacketList) PushFront(v Packet) *PacketElement

PushFront inserts a new element e with value v at the front of list l and returns e.

func (*PacketList) PushFrontList

func (l *PacketList) PushFrontList(other *PacketList)

PushFrontList inserts a copy of an other list at the front of list l. The lists l and other may be the same.

func (*PacketList) Remove

func (l *PacketList) Remove(e *PacketElement) Packet

Remove removes e from l if e is an element of list l. It returns the element value e.Value.

type ReceivedPacketHandler

type ReceivedPacketHandler interface {
	ReceivedPacket(packetNumber protocol.PacketNumber, shouldInstigateAck bool) error
	SetLowerLimit(protocol.PacketNumber)

	GetAlarmTimeout() time.Time
	GetAckFrame() *wire.AckFrame

	GetClosePathFrame() *wire.ClosePathFrame

	GetStatistics() (uint64, uint64, uint64)

	StatisticPacketMeet(hdr *wire.PublicHeader, rcvTime time.Time) error

	//czy
	UpdateCurNotSent(curNotSent uint16)
	UpdateAlpha(alpha uint16)
}

ReceivedPacketHandler handles ACKs needed to send for incoming packets

func NewReceivedPacketHandler

func NewReceivedPacketHandler(version protocol.VersionNumber) ReceivedPacketHandler

NewReceivedPacketHandler creates a new receivedPacketHandler

type SentPacketHandler

type SentPacketHandler interface {
	// SentPacket may modify the packet
	SentPacket(packet *Packet) error
	ReceivedAck(ackFrame *wire.AckFrame, withPacketNumber protocol.PacketNumber, recvTime time.Time) error

	// Specific to multipath operation
	ReceivedClosePath(f *wire.ClosePathFrame, withPacketNumber protocol.PacketNumber, recvTime time.Time) error
	SetInflightAsLost()

	SendingAllowed() bool
	GetStopWaitingFrame(force bool) *wire.StopWaitingFrame
	ShouldSendRetransmittablePacket() bool
	DequeuePacketForRetransmission() (packet *Packet)
	GetLeastUnacked() protocol.PacketNumber

	GetAlarmTimeout() time.Time
	OnAlarm()

	DuplicatePacket(packet *Packet)

	GetStatistics() (uint64, uint64, uint64)
	GetLastPackets() uint64
	GetAckedBytes() protocol.ByteCount
	GetSentBytes() protocol.ByteCount
	GetCongestionWindow() protocol.ByteCount
	GetBytesInFlight() protocol.ByteCount

	GetPathAlpha() float32

	// czy
	CalculateMeetRatio() float32
	CalculateInstantMeetRatio() float32
	CalculateHistoryMeetRatio(armIndex int) float32
}

SentPacketHandler handles ACKs received for outgoing packets

func NewSentPacketHandler

func NewSentPacketHandler(rttStats *congestion.RTTStats, cong congestion.SendAlgorithm, onRTOCallback func(time.Time) bool) SentPacketHandler

NewSentPacketHandler creates a new sentPacketHandler

Jump to

Keyboard shortcuts

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