don't switch to PTO mode after early retransmit

This commit is contained in:
Marten Seemann 2020-05-31 10:47:13 +07:00
parent ee8a0aeb1b
commit 64ef72fd68
2 changed files with 9 additions and 0 deletions

View file

@ -603,6 +603,7 @@ func (h *sentPacketHandler) onVerifiedLossDetectionTimeout() error {
for _, p := range lostPackets {
h.congestion.OnPacketLost(p.PacketNumber, p.Length, priorInFlight)
}
return nil
}
// PTO

View file

@ -913,6 +913,7 @@ var _ = Describe("SentPacketHandler", func() {
})
It("sets the early retransmit alarm", func() {
handler.ReceivedPacket(protocol.EncryptionHandshake)
handler.handshakeComplete = true
now := time.Now()
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 1, SendTime: now.Add(-2 * time.Second)}))
@ -926,12 +927,16 @@ var _ = Describe("SentPacketHandler", func() {
// Packet 1 should be considered lost (1+1/8) RTTs after it was sent.
Expect(handler.GetLossDetectionTimeout().Sub(getPacket(1, protocol.Encryption1RTT).SendTime)).To(Equal(time.Second * 9 / 8))
Expect(handler.SendMode()).To(Equal(SendAny))
expectInPacketHistory([]protocol.PacketNumber{1, 3}, protocol.Encryption1RTT)
Expect(handler.OnLossDetectionTimeout()).To(Succeed())
expectInPacketHistory([]protocol.PacketNumber{3}, protocol.Encryption1RTT)
Expect(handler.SendMode()).To(Equal(SendAny))
})
It("sets the early retransmit alarm for crypto packets", func() {
handler.ReceivedBytes(1000)
now := time.Now()
handler.SentPacket(initialPacket(&Packet{PacketNumber: 1, SendTime: now.Add(-2 * time.Second)}))
handler.SentPacket(initialPacket(&Packet{PacketNumber: 2, SendTime: now.Add(-2 * time.Second)}))
@ -944,9 +949,12 @@ var _ = Describe("SentPacketHandler", func() {
// Packet 1 should be considered lost (1+1/8) RTTs after it was sent.
Expect(handler.GetLossDetectionTimeout().Sub(getPacket(1, protocol.EncryptionInitial).SendTime)).To(Equal(time.Second * 9 / 8))
Expect(handler.SendMode()).To(Equal(SendAny))
expectInPacketHistory([]protocol.PacketNumber{1, 3}, protocol.EncryptionInitial)
Expect(handler.OnLossDetectionTimeout()).To(Succeed())
expectInPacketHistory([]protocol.PacketNumber{3}, protocol.EncryptionInitial)
Expect(handler.SendMode()).To(Equal(SendAny))
})
})