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
|
// 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{
|
return &cubicSender{
|
||||||
rttStats: rttStats,
|
rttStats: rttStats,
|
||||||
initialCongestionWindow: initialCongestionWindow,
|
initialCongestionWindow: initialCongestionWindow,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func (c *mockClock) Advance(d time.Duration) {
|
|||||||
|
|
||||||
var _ = Describe("Cubic Sender", func() {
|
var _ = Describe("Cubic Sender", func() {
|
||||||
var (
|
var (
|
||||||
sender congestion.SendAlgorithm
|
sender congestion.SendAlgorithmWithDebugInfo
|
||||||
clock mockClock
|
clock mockClock
|
||||||
bytesInFlight protocol.ByteCount
|
bytesInFlight protocol.ByteCount
|
||||||
packetNumber protocol.PacketNumber
|
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
|
OnPacketSent(sentTime time.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool) bool
|
||||||
GetCongestionWindow() protocol.ByteCount
|
GetCongestionWindow() protocol.ByteCount
|
||||||
OnCongestionEvent(rttUpdated bool, bytesInFlight protocol.ByteCount, ackedPackets PacketVector, lostPackets PacketVector)
|
OnCongestionEvent(rttUpdated bool, bytesInFlight protocol.ByteCount, ackedPackets PacketVector, lostPackets PacketVector)
|
||||||
BandwidthEstimate() Bandwidth
|
|
||||||
SetNumEmulatedConnections(n int)
|
SetNumEmulatedConnections(n int)
|
||||||
OnRetransmissionTimeout(packetsRetransmitted bool)
|
OnRetransmissionTimeout(packetsRetransmitted bool)
|
||||||
OnConnectionMigration()
|
OnConnectionMigration()
|
||||||
@@ -19,9 +18,15 @@ type SendAlgorithm interface {
|
|||||||
|
|
||||||
// Experiments
|
// Experiments
|
||||||
SetSlowStartLargeReduction(enabled bool)
|
SetSlowStartLargeReduction(enabled bool)
|
||||||
|
}
|
||||||
|
|
||||||
|
type SendAlgorithmWithDebugInfo interface {
|
||||||
|
SendAlgorithm
|
||||||
|
BandwidthEstimate() Bandwidth
|
||||||
|
|
||||||
// Stuff only used in testing
|
// Stuff only used in testing
|
||||||
// TODO: Maybe make CubicSender public and typeassert in tests?
|
// TODO: Maybe make CubicSender public and typeassert in tests?
|
||||||
|
|
||||||
HybridSlowStart() *HybridSlowStart
|
HybridSlowStart() *HybridSlowStart
|
||||||
SlowstartThreshold() protocol.PacketNumber
|
SlowstartThreshold() protocol.PacketNumber
|
||||||
RenoBeta() float32
|
RenoBeta() float32
|
||||||
|
|||||||
Reference in New Issue
Block a user