forked from quic-go/quic-go
fix limit of undecrytable packets queue length
fixes #517 Also fixes an off-by-one error, such that the queue now holds exactly protocol.MaxUndecrytablePackets packets when enough undecryptable packets are received.
This commit is contained in:
12
session.go
12
session.go
@@ -782,12 +782,16 @@ func (s *session) tryQueueingUndecryptablePacket(p *receivedPacket) {
|
||||
if s.cryptoSetup.HandshakeComplete() {
|
||||
return
|
||||
}
|
||||
utils.Infof("Queueing packet 0x%x for later decryption", p.publicHeader.PacketNumber)
|
||||
if len(s.undecryptablePackets)+1 >= protocol.MaxUndecryptablePackets && s.receivedTooManyUndecrytablePacketsTime.IsZero() {
|
||||
s.receivedTooManyUndecrytablePacketsTime = time.Now()
|
||||
s.maybeResetTimer()
|
||||
if len(s.undecryptablePackets)+1 > protocol.MaxUndecryptablePackets {
|
||||
// if this is the first time the undecryptablePackets runs full, start the timer to send a Public Reset
|
||||
if s.receivedTooManyUndecrytablePacketsTime.IsZero() {
|
||||
s.receivedTooManyUndecrytablePacketsTime = time.Now()
|
||||
s.maybeResetTimer()
|
||||
}
|
||||
utils.Infof("Dropping undecrytable packet 0x%x (undecryptable packet queue full)", p.publicHeader.PacketNumber)
|
||||
return
|
||||
}
|
||||
utils.Infof("Queueing packet 0x%x for later decryption", p.publicHeader.PacketNumber)
|
||||
s.undecryptablePackets = append(s.undecryptablePackets, p)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user