utils: switch to standard library min and max functions (#4218)

These functions were added in Go 1.21.
This commit is contained in:
Marten Seemann
2023-12-28 12:19:13 +07:00
committed by GitHub
parent 18c591c75a
commit 22411e16d5
24 changed files with 44 additions and 78 deletions

View File

@@ -5,7 +5,6 @@ import (
"encoding/binary"
"github.com/quic-go/quic-go/internal/protocol"
"github.com/quic-go/quic-go/internal/utils"
)
func createAEAD(suite *cipherSuite, trafficSecret []byte, v protocol.VersionNumber) cipher.AEAD {
@@ -82,7 +81,7 @@ func (o *longHeaderOpener) Open(dst, src []byte, pn protocol.PacketNumber, ad []
// It uses the nonce provided here and XOR it with the IV.
dec, err := o.aead.Open(dst, o.nonceBuf, src, ad)
if err == nil {
o.highestRcvdPN = utils.Max(o.highestRcvdPN, pn)
o.highestRcvdPN = max(o.highestRcvdPN, pn)
} else {
err = ErrDecryptionFailed
}

View File

@@ -172,7 +172,7 @@ func (a *updatableAEAD) Open(dst, src []byte, rcvTime time.Time, pn protocol.Pac
}
}
if err == nil {
a.highestRcvdPN = utils.Max(a.highestRcvdPN, pn)
a.highestRcvdPN = max(a.highestRcvdPN, pn)
}
return dec, err
}