ackhandler: remove unneeded SetHandshakeConfirmed from SentPacketHandler (#4890)

According to section 4.9.2 of RFC 9001, dropping the Handshake packet
number spaces happens when the handshake is confirmed.
This commit is contained in:
Marten Seemann
2025-01-19 20:59:27 -08:00
committed by GitHub
parent 92dc1970ec
commit 2d2538d790
5 changed files with 3 additions and 52 deletions

View File

@@ -17,7 +17,6 @@ type SentPacketHandler interface {
ReceivedBytes(_ protocol.ByteCount, rcvTime time.Time)
DropPackets(_ protocol.EncryptionLevel, rcvTime time.Time)
ResetForRetry(rcvTime time.Time)
SetHandshakeConfirmed(now time.Time)
// The SendMode determines if and what kind of packets can be sent.
SendMode(now time.Time) SendMode

View File

@@ -179,6 +179,9 @@ func (h *sentPacketHandler) DropPackets(encLevel protocol.EncryptionLevel, now t
case protocol.EncryptionInitial:
h.initialPackets = nil
case protocol.EncryptionHandshake:
// Dropping the handshake packet number space means that the handshake is confirmed,
// see section 4.9.2 of RFC 9001.
h.handshakeConfirmed = true
h.handshakePackets = nil
case protocol.Encryption0RTT:
// This function is only called when 0-RTT is rejected,
@@ -912,16 +915,3 @@ func (h *sentPacketHandler) ResetForRetry(now time.Time) {
}
h.ptoCount = 0
}
func (h *sentPacketHandler) SetHandshakeConfirmed(now time.Time) {
if h.initialPackets != nil {
panic("didn't drop initial correctly")
}
if h.handshakePackets != nil {
panic("didn't drop handshake correctly")
}
h.handshakeConfirmed = true
// We don't send PTOs for application data packets before the handshake completes.
// Make sure the timer is armed now, if necessary.
h.setLossDetectionTimer(now)
}

View File

@@ -133,7 +133,6 @@ var _ = Describe("SentPacketHandler", func() {
setHandshakeConfirmed := func() {
handler.DropPackets(protocol.EncryptionInitial, time.Now())
handler.DropPackets(protocol.EncryptionHandshake, time.Now())
handler.SetHandshakeConfirmed(time.Now())
}
Context("registering sent packets", func() {