don't use a lower RTT than 5ms after receiving a Retry packet

This commit is contained in:
Marten Seemann 2021-03-26 15:55:30 +07:00
parent 81d16a9903
commit d48c08037a
2 changed files with 19 additions and 1 deletions

View file

@ -1201,6 +1201,21 @@ var _ = Describe("SentPacketHandler", func() {
Expect(handler.rttStats.SmoothedRTT()).To(BeNumerically("~", 500*time.Millisecond, 100*time.Millisecond))
})
It("uses a Retry for an RTT estimate, but doesn't set the RTT to a value lower than 5ms", func() {
handler.SentPacket(ackElicitingPacket(&Packet{
PacketNumber: 42,
EncryptionLevel: protocol.EncryptionInitial,
SendTime: time.Now().Add(-500 * time.Microsecond),
}))
handler.SentPacket(ackElicitingPacket(&Packet{
PacketNumber: 43,
EncryptionLevel: protocol.EncryptionInitial,
SendTime: time.Now().Add(-10 * time.Microsecond),
}))
Expect(handler.ResetForRetry()).To(Succeed())
Expect(handler.rttStats.SmoothedRTT()).To(Equal(minRTTAfterRetry))
})
It("doesn't use a Retry for an RTT estimate, if it was not retransmitted", func() {
handler.SentPacket(ackElicitingPacket(&Packet{
PacketNumber: 42,