Skip to content

Commit

Permalink
chore: tweak SendAlgorithmEx interface
Browse files Browse the repository at this point in the history
(cherry picked from commit 13cecb4)
  • Loading branch information
tobyxdd committed Sep 30, 2023
1 parent 18cc078 commit da4c015
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion internal/ackhandler/cc_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import (
"github.com/quic-go/quic-go/internal/protocol"
)

var _ cgInternal.SendAlgorithmEx = &ccAdapter{}
var (
_ cgInternal.SendAlgorithmEx = &ccAdapter{}
_ cgInternal.SendAlgorithmWithDebugInfos = &ccAdapter{}
)

type ccAdapter struct {
CC congestion.CongestionControl
Expand Down
10 changes: 5 additions & 5 deletions internal/congestion/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ type SendAlgorithm interface {
SetMaxDatagramSize(protocol.ByteCount)
}

type SendAlgorithmEx interface {
SendAlgorithm
OnCongestionEventEx(priorInFlight protocol.ByteCount, eventTime time.Time, ackedPackets []congestion.AckedPacketInfo, lostPackets []congestion.LostPacketInfo)
}

// A SendAlgorithmWithDebugInfos is a SendAlgorithm that exposes some debug infos
type SendAlgorithmWithDebugInfos interface {
SendAlgorithm
InSlowStart() bool
InRecovery() bool
GetCongestionWindow() protocol.ByteCount
}

type SendAlgorithmEx interface {
SendAlgorithmWithDebugInfos
OnCongestionEventEx(priorInFlight protocol.ByteCount, eventTime time.Time, ackedPackets []congestion.AckedPacketInfo, lostPackets []congestion.LostPacketInfo)
}

0 comments on commit da4c015

Please sign in to comment.