quicvarint: use int return value instead of internal protocol.ByteCount (#4356)

This commit is contained in:
Marten Seemann
2024-03-20 07:56:55 +10:00
committed by GitHub
parent 4a99b816ae
commit 6325696fde
33 changed files with 60 additions and 53 deletions

View File

@@ -163,7 +163,7 @@ func (f *AckFrame) Length(_ protocol.Version) protocol.ByteCount {
length += quicvarint.Len(f.ECT1)
length += quicvarint.Len(f.ECNCE)
}
return length
return protocol.ByteCount(length)
}
// gets the number of ACK ranges that can be encoded
@@ -174,7 +174,7 @@ func (f *AckFrame) numEncodableAckRanges() int {
for i := 1; i < len(f.AckRanges); i++ {
gap, len := f.encodeAckRange(i)
rangeLen := quicvarint.Len(gap) + quicvarint.Len(len)
if length+rangeLen > protocol.MaxAckFrameSize {
if protocol.ByteCount(length+rangeLen) > protocol.MaxAckFrameSize {
// Writing range i would exceed the MaxAckFrameSize.
// So encode one range less than that.
return i - 1