mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-07-23 11:58:02 +00:00
Merge pull request #973 from apernet/fix-cwnd-undersize
fix: cwnd undersize in extremely-low rtt scenarios
This commit is contained in:
@@ -69,7 +69,7 @@ func (b *BrutalSender) HasPacingBudget(now time.Time) bool {
|
||||
}
|
||||
|
||||
func (b *BrutalSender) CanSend(bytesInFlight congestion.ByteCount) bool {
|
||||
return bytesInFlight < b.GetCongestionWindow()
|
||||
return bytesInFlight <= b.GetCongestionWindow()
|
||||
}
|
||||
|
||||
func (b *BrutalSender) GetCongestionWindow() congestion.ByteCount {
|
||||
@@ -77,7 +77,11 @@ func (b *BrutalSender) GetCongestionWindow() congestion.ByteCount {
|
||||
if rtt <= 0 {
|
||||
return 10240
|
||||
}
|
||||
return congestion.ByteCount(float64(b.bps) * rtt.Seconds() * congestionWindowMultiplier / b.ackRate)
|
||||
cwnd := congestion.ByteCount(float64(b.bps) * rtt.Seconds() * congestionWindowMultiplier / b.ackRate)
|
||||
if cwnd < b.maxDatagramSize {
|
||||
cwnd = b.maxDatagramSize
|
||||
}
|
||||
return cwnd
|
||||
}
|
||||
|
||||
func (b *BrutalSender) OnPacketSent(sentTime time.Time, bytesInFlight congestion.ByteCount,
|
||||
|
Reference in New Issue
Block a user