mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
Merge pull request #2228 from lucas-clemente/fix-pto-for-dropped-pn-spaces
reset the loss detection timer when dropping a packet number space
This commit is contained in:
commit
c46c72aae8
2 changed files with 24 additions and 0 deletions
|
@ -120,6 +120,8 @@ func (h *sentPacketHandler) DropPackets(encLevel protocol.EncryptionLevel) {
|
|||
default:
|
||||
panic(fmt.Sprintf("Cannot drop keys for encryption level %s", encLevel))
|
||||
}
|
||||
h.setLossDetectionTimer()
|
||||
h.ptoMode = SendNone
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) SentPacket(packet *Packet) {
|
||||
|
|
|
@ -590,6 +590,28 @@ var _ = Describe("SentPacketHandler", func() {
|
|||
Expect(handler.GetLossDetectionTimeout().Sub(sendTime)).To(Equal(4 * timeout))
|
||||
})
|
||||
|
||||
It("resets the PTO mode when a packet number space is dropped", func() {
|
||||
now := time.Now()
|
||||
handler.SentPacket(ackElicitingPacket(&Packet{
|
||||
PacketNumber: 1,
|
||||
EncryptionLevel: protocol.EncryptionHandshake,
|
||||
SendTime: now.Add(-2 * time.Hour),
|
||||
}))
|
||||
handler.SentPacket(ackElicitingPacket(&Packet{
|
||||
PacketNumber: 2,
|
||||
SendTime: now.Add(-time.Hour),
|
||||
}))
|
||||
// PTO timer based on the Handshake packet
|
||||
Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-2*time.Hour), time.Second))
|
||||
Expect(handler.OnLossDetectionTimeout()).To(Succeed())
|
||||
Expect(handler.SendMode()).To(Equal(SendPTOHandshake))
|
||||
handler.SetHandshakeComplete()
|
||||
handler.DropPackets(protocol.EncryptionHandshake)
|
||||
// PTO timer based on the 1-RTT packet
|
||||
Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Hour), time.Second))
|
||||
Expect(handler.SendMode()).ToNot(Equal(SendPTOHandshake))
|
||||
})
|
||||
|
||||
It("allows two 1-RTT PTOs", func() {
|
||||
handler.SetHandshakeComplete()
|
||||
var lostPackets []protocol.PacketNumber
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue