Skip to content

Commit

Permalink
congestion/cubic.go: added a minimum window
Browse files Browse the repository at this point in the history
  • Loading branch information
cooldogedev committed Oct 11, 2024
1 parent 74f86aa commit f00f31f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/congestion/cubic.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

const (
initialWindow = protocol.MaxPacketSize * 32
minWindow = protocol.MaxPacketSize * 2
maxWindow = protocol.MaxPacketSize * 10000

cubicC = 0.7
Expand Down Expand Up @@ -69,7 +70,7 @@ func (c *Cubic) OnAck(bytes float64) {
func (c *Cubic) OnLoss(bytes float64) {
c.mu.Lock()
c.wMax = c.cwnd
c.cwnd *= cubicBeta
c.cwnd = max(c.cwnd*cubicBeta, minWindow)
c.inFlight = max(c.inFlight-bytes, 0)
c.ssthresh = c.cwnd
c.epochStart = time.Time{}
Expand Down

0 comments on commit f00f31f

Please sign in to comment.