forked from quic-go/quic-go
introduce separate congestion debug interface to simplify mocking
This commit is contained in:
@@ -62,7 +62,7 @@ type cubicSender struct {
|
||||
}
|
||||
|
||||
// NewCubicSender makes a new cubic sender
|
||||
func NewCubicSender(clock Clock, rttStats *RTTStats, reno bool, initialCongestionWindow, initialMaxCongestionWindow protocol.PacketNumber) SendAlgorithm {
|
||||
func NewCubicSender(clock Clock, rttStats *RTTStats, reno bool, initialCongestionWindow, initialMaxCongestionWindow protocol.PacketNumber) SendAlgorithmWithDebugInfo {
|
||||
return &cubicSender{
|
||||
rttStats: rttStats,
|
||||
initialCongestionWindow: initialCongestionWindow,
|
||||
|
||||
@@ -25,7 +25,7 @@ func (c *mockClock) Advance(d time.Duration) {
|
||||
|
||||
var _ = Describe("Cubic Sender", func() {
|
||||
var (
|
||||
sender congestion.SendAlgorithm
|
||||
sender congestion.SendAlgorithmWithDebugInfo
|
||||
clock mockClock
|
||||
bytesInFlight protocol.ByteCount
|
||||
packetNumber protocol.PacketNumber
|
||||
|
||||
@@ -11,7 +11,6 @@ type SendAlgorithm interface {
|
||||
OnPacketSent(sentTime time.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool) bool
|
||||
GetCongestionWindow() protocol.ByteCount
|
||||
OnCongestionEvent(rttUpdated bool, bytesInFlight protocol.ByteCount, ackedPackets PacketVector, lostPackets PacketVector)
|
||||
BandwidthEstimate() Bandwidth
|
||||
SetNumEmulatedConnections(n int)
|
||||
OnRetransmissionTimeout(packetsRetransmitted bool)
|
||||
OnConnectionMigration()
|
||||
@@ -19,9 +18,15 @@ type SendAlgorithm interface {
|
||||
|
||||
// Experiments
|
||||
SetSlowStartLargeReduction(enabled bool)
|
||||
}
|
||||
|
||||
type SendAlgorithmWithDebugInfo interface {
|
||||
SendAlgorithm
|
||||
BandwidthEstimate() Bandwidth
|
||||
|
||||
// Stuff only used in testing
|
||||
// TODO: Maybe make CubicSender public and typeassert in tests?
|
||||
|
||||
HybridSlowStart() *HybridSlowStart
|
||||
SlowstartThreshold() protocol.PacketNumber
|
||||
RenoBeta() float32
|
||||
|
||||
Reference in New Issue
Block a user