forked from quic-go/quic-go
initial hybrid slow start implementation
This commit is contained in:
25
congestion/hybrid_slow_start.go
Normal file
25
congestion/hybrid_slow_start.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package congestion
|
||||
|
||||
import "time"
|
||||
|
||||
// HybridSlowStart implements the TCP hybrid slow start algorithm
|
||||
type HybridSlowStart struct {
|
||||
endPacketNumber uint64
|
||||
lastSentPacketNumber uint64
|
||||
started bool
|
||||
currentMinRTT time.Duration
|
||||
rttSampleCount uint32
|
||||
}
|
||||
|
||||
// StartReceiveRound is called for the start of each receive round (burst) in the slow start phase.
|
||||
func (s *HybridSlowStart) StartReceiveRound(last_sent uint64) {
|
||||
s.endPacketNumber = last_sent
|
||||
s.currentMinRTT = 0
|
||||
s.rttSampleCount = 0
|
||||
s.started = true
|
||||
}
|
||||
|
||||
// IsEndOfRound returns true if this ack is the last packet number of our current slow start round.
|
||||
func (s *HybridSlowStart) IsEndOfRound(ack uint64) bool {
|
||||
return s.endPacketNumber < ack
|
||||
}
|
||||
Reference in New Issue
Block a user