Merge pull request #2569 from lucas-clemente/drop-duplicate-packets

drop duplicate packets
This commit is contained in:
Marten Seemann
2020-05-29 16:39:46 +07:00
committed by GitHub
10 changed files with 170 additions and 4 deletions

View File

@@ -137,3 +137,21 @@ func (h *receivedPacketHandler) GetAckFrame(encLevel protocol.EncryptionLevel) *
}
return ack
}
func (h *receivedPacketHandler) IsPotentiallyDuplicate(pn protocol.PacketNumber, encLevel protocol.EncryptionLevel) bool {
switch encLevel {
case protocol.EncryptionInitial:
if h.initialPackets != nil {
return h.initialPackets.IsPotentiallyDuplicate(pn)
}
case protocol.EncryptionHandshake:
if h.handshakePackets != nil {
return h.handshakePackets.IsPotentiallyDuplicate(pn)
}
case protocol.Encryption0RTT, protocol.Encryption1RTT:
if h.appDataPackets != nil {
return h.appDataPackets.IsPotentiallyDuplicate(pn)
}
}
panic("unexpected encryption level")
}