forked from quic-go/quic-go
don't retransmit 0-RTT packets when 0-RTT is rejected
This commit is contained in:
@@ -169,15 +169,14 @@ func (h *sentPacketHandler) dropPackets(encLevel protocol.EncryptionLevel) {
|
|||||||
case protocol.EncryptionHandshake:
|
case protocol.EncryptionHandshake:
|
||||||
h.handshakePackets = nil
|
h.handshakePackets = nil
|
||||||
case protocol.Encryption0RTT:
|
case protocol.Encryption0RTT:
|
||||||
// TODO(#2067): invalidate sent data
|
// This function is only called when 0-RTT is rejected,
|
||||||
|
// and not when the client drops 0-RTT keys when the handshake completes.
|
||||||
|
// When 0-RTT is rejected, all application data sent so far becomes invalid.
|
||||||
|
// Delete the packets from the history and remove them from bytes_in_flight.
|
||||||
h.appDataPackets.history.Iterate(func(p *Packet) (bool, error) {
|
h.appDataPackets.history.Iterate(func(p *Packet) (bool, error) {
|
||||||
if p.skippedPacket {
|
|
||||||
return true, nil
|
|
||||||
}
|
|
||||||
if p.EncryptionLevel != protocol.Encryption0RTT {
|
if p.EncryptionLevel != protocol.Encryption0RTT {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
h.queueFramesForRetransmission(p)
|
|
||||||
h.removeFromBytesInFlight(p)
|
h.removeFromBytesInFlight(p)
|
||||||
h.appDataPackets.history.Remove(p.PacketNumber)
|
h.appDataPackets.history.Remove(p.PacketNumber)
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|||||||
@@ -1078,8 +1078,7 @@ var _ = Describe("SentPacketHandler", func() {
|
|||||||
Expect(handler.handshakePackets).To(BeNil())
|
Expect(handler.handshakePackets).To(BeNil())
|
||||||
})
|
})
|
||||||
|
|
||||||
// TODO(#2067): invalidate 0-RTT data when 0-RTT is rejected
|
It("doesn't retransmit 0-RTT packets when 0-RTT keys are dropped", func() {
|
||||||
It("retransmits 0-RTT packets when 0-RTT keys are dropped", func() {
|
|
||||||
for i := protocol.PacketNumber(0); i < 6; i++ {
|
for i := protocol.PacketNumber(0); i < 6; i++ {
|
||||||
if i == 3 {
|
if i == 3 {
|
||||||
continue
|
continue
|
||||||
@@ -1094,7 +1093,7 @@ var _ = Describe("SentPacketHandler", func() {
|
|||||||
}
|
}
|
||||||
Expect(handler.bytesInFlight).To(Equal(protocol.ByteCount(11)))
|
Expect(handler.bytesInFlight).To(Equal(protocol.ByteCount(11)))
|
||||||
handler.DropPackets(protocol.Encryption0RTT)
|
handler.DropPackets(protocol.Encryption0RTT)
|
||||||
Expect(lostPackets).To(Equal([]protocol.PacketNumber{0, 1, 2, 4, 5}))
|
Expect(lostPackets).To(BeEmpty())
|
||||||
Expect(handler.bytesInFlight).To(Equal(protocol.ByteCount(6)))
|
Expect(handler.bytesInFlight).To(Equal(protocol.ByteCount(6)))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user