Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset the PTO when dropping a packet number space #2527

Merged
merged 1 commit into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/ackhandler/sent_packet_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func (h *sentPacketHandler) dropPackets(encLevel protocol.EncryptionLevel) {
h.qlogger.UpdatedPTOCount(0)
}
h.ptoCount = 0
h.numProbesToSend = 0
h.ptoMode = SendNone
}

Expand Down
13 changes: 13 additions & 0 deletions internal/ackhandler/sent_packet_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,19 @@ var _ = Describe("SentPacketHandler", func() {
Expect(lostPackets).To(Equal([]protocol.PacketNumber{0, 1, 2, 3, 4, 5}))
Expect(handler.bytesInFlight).To(Equal(protocol.ByteCount(6)))
})

It("cancels the PTO when dropping a packet number space", func() {
now := time.Now()
handler.SentPacket(handshakePacket(&Packet{PacketNumber: 1, SendTime: now.Add(-time.Minute)}))
handler.SentPacket(handshakePacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)}))
Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second))
Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOHandshake))
Expect(handler.ptoCount).To(BeEquivalentTo(1))
handler.DropPackets(protocol.EncryptionHandshake)
Expect(handler.ptoCount).To(BeZero())
Expect(handler.SendMode()).To(Equal(SendAny))
})
})

Context("peeking and popping packet number", func() {
Expand Down