mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-07 06:07:36 +03:00
move varint encoding / decoding to a separate package
... which is not internal.
This commit is contained in:
parent
602212e983
commit
11c5045065
47 changed files with 319 additions and 286 deletions
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
"github.com/lucas-clemente/quic-go/quicvarint"
|
||||
)
|
||||
|
||||
// A MaxStreamsFrame is a MAX_STREAMS frame
|
||||
|
@ -27,7 +27,7 @@ func parseMaxStreamsFrame(r *bytes.Reader, _ protocol.VersionNumber) (*MaxStream
|
|||
case 0x13:
|
||||
f.Type = protocol.StreamTypeUni
|
||||
}
|
||||
streamID, err := utils.ReadVarInt(r)
|
||||
streamID, err := quicvarint.ReadVarInt(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ func (f *MaxStreamsFrame) Write(b *bytes.Buffer, _ protocol.VersionNumber) error
|
|||
case protocol.StreamTypeUni:
|
||||
b.WriteByte(0x13)
|
||||
}
|
||||
utils.WriteVarInt(b, uint64(f.MaxStreamNum))
|
||||
quicvarint.WriteVarInt(b, uint64(f.MaxStreamNum))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Length of a written frame
|
||||
func (f *MaxStreamsFrame) Length(protocol.VersionNumber) protocol.ByteCount {
|
||||
return 1 + utils.VarIntLen(uint64(f.MaxStreamNum))
|
||||
return 1 + quicvarint.VarIntLen(uint64(f.MaxStreamNum))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue