don’t send a Public Reset if trial decryption succeeds

fixes #516
This commit is contained in:
Marten Seemann 2017-04-11 10:45:08 +07:00
parent 8565fdf722
commit 81e06c1f02
No known key found for this signature in database
GPG key ID: 3603F40B121FCDEA
2 changed files with 37 additions and 25 deletions

View file

@ -261,7 +261,7 @@ runLoop:
if err := s.sendPacket(); err != nil {
s.close(err)
}
if !s.receivedTooManyUndecrytablePacketsTime.IsZero() && s.receivedTooManyUndecrytablePacketsTime.Add(protocol.PublicResetTimeout).Before(now) {
if !s.receivedTooManyUndecrytablePacketsTime.IsZero() && s.receivedTooManyUndecrytablePacketsTime.Add(protocol.PublicResetTimeout).Before(now) && len(s.undecryptablePackets) != 0 {
s.close(qerr.Error(qerr.DecryptionFailure, "too many undecryptable packets received"))
}
if now.Sub(s.lastNetworkActivityTime) >= s.idleTimeout() {