Skip to content

Commit

Permalink
don't pace when congestion limited
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Jul 2, 2019
1 parent 3dcbaee commit 1a272cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/congestion/cubic_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ func NewCubicSender(clock Clock, rttStats *RTTStats, reno bool, initialCongestio

// TimeUntilSend returns when the next packet should be sent.
func (c *cubicSender) TimeUntilSend(bytesInFlight protocol.ByteCount) time.Duration {
if !c.CanSend(bytesInFlight) {
return utils.InfDuration
}
if !c.noPRR && c.InRecovery() {
// PRR is used when in recovery.
if c.prr.CanSend(c.GetCongestionWindow(), bytesInFlight, c.GetSlowStartThreshold()) {
Expand Down
6 changes: 6 additions & 0 deletions internal/congestion/cubic_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ var _ = Describe("Cubic Sender", func() {
Expect(delay).ToNot(Equal(utils.InfDuration))
})

It("stops pacing when congestion limited", func() {
bytesInFlight := sender.GetCongestionWindow()
Expect(sender.CanSend(bytesInFlight)).To(BeFalse())
Expect(sender.TimeUntilSend(bytesInFlight)).To(Equal(utils.InfDuration))
})

It("application limited slow start", func() {
// Send exactly 10 packets and ensure the CWND ends at 14 packets.
const numberOfAcks = 5
Expand Down

0 comments on commit 1a272cb

Please sign in to comment.