From 2976a3ee1941e9ff84cdd2a5e2093312c706190d Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sun, 7 Apr 2019 13:11:36 +0900 Subject: [PATCH] fix pacing rate The pacing rate needs to be calculated for the next packet to be sent, not for the next byte to be sent. --- internal/congestion/cubic_sender.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/congestion/cubic_sender.go b/internal/congestion/cubic_sender.go index 33ef491fc..a2b0af51a 100644 --- a/internal/congestion/cubic_sender.go +++ b/internal/congestion/cubic_sender.go @@ -89,7 +89,7 @@ func (c *cubicSender) TimeUntilSend(bytesInFlight protocol.ByteCount) time.Durat return 0 } } - delay := c.rttStats.SmoothedRTT() / time.Duration(2*c.GetCongestionWindow()) + delay := c.rttStats.SmoothedRTT() * time.Duration(protocol.DefaultTCPMSS) / time.Duration(2*c.GetCongestionWindow()) if !c.InSlowStart() { // adjust delay, such that it's 1.25*cwd/rtt delay = delay * 8 / 5 }