mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
simplify pruning of old ACK ranges
This commit is contained in:
parent
f317a471bb
commit
a5fc72047e
11 changed files with 94 additions and 50 deletions
|
@ -32,6 +32,8 @@ const (
|
|||
)
|
||||
|
||||
type receivedPacketHandler struct {
|
||||
sentPackets sentPacketTracker
|
||||
|
||||
initialPackets *receivedPacketTracker
|
||||
handshakePackets *receivedPacketTracker
|
||||
appDataPackets *receivedPacketTracker
|
||||
|
@ -42,11 +44,13 @@ type receivedPacketHandler struct {
|
|||
var _ ReceivedPacketHandler = &receivedPacketHandler{}
|
||||
|
||||
func newReceivedPacketHandler(
|
||||
sentPackets sentPacketTracker,
|
||||
rttStats *congestion.RTTStats,
|
||||
logger utils.Logger,
|
||||
version protocol.VersionNumber,
|
||||
) ReceivedPacketHandler {
|
||||
return &receivedPacketHandler{
|
||||
sentPackets: sentPackets,
|
||||
initialPackets: newReceivedPacketTracker(rttStats, logger, version),
|
||||
handshakePackets: newReceivedPacketTracker(rttStats, logger, version),
|
||||
appDataPackets: newReceivedPacketTracker(rttStats, logger, version),
|
||||
|
@ -74,6 +78,7 @@ func (h *receivedPacketHandler) ReceivedPacket(
|
|||
if h.lowest1RTTPacket == protocol.InvalidPacketNumber || pn < h.lowest1RTTPacket {
|
||||
h.lowest1RTTPacket = pn
|
||||
}
|
||||
h.appDataPackets.IgnoreBelow(h.sentPackets.GetLowestPacketNotConfirmedAcked())
|
||||
h.appDataPackets.ReceivedPacket(pn, rcvTime, shouldInstigateAck)
|
||||
default:
|
||||
panic(fmt.Sprintf("received packet with unknown encryption level: %s", encLevel))
|
||||
|
@ -81,11 +86,6 @@ func (h *receivedPacketHandler) ReceivedPacket(
|
|||
return nil
|
||||
}
|
||||
|
||||
// only to be used with 1-RTT packets
|
||||
func (h *receivedPacketHandler) IgnoreBelow(pn protocol.PacketNumber) {
|
||||
h.appDataPackets.IgnoreBelow(pn)
|
||||
}
|
||||
|
||||
func (h *receivedPacketHandler) DropPackets(encLevel protocol.EncryptionLevel) {
|
||||
switch encLevel {
|
||||
case protocol.EncryptionInitial:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue