mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
rename ReadVarint / WriteVarInt / VarIntLen to Read / Write / Len
This commit is contained in:
parent
11c5045065
commit
f9226887b4
46 changed files with 298 additions and 298 deletions
|
@ -32,11 +32,11 @@ func parseNextFrame(b io.Reader) (frame, error) {
|
|||
if !ok {
|
||||
br = &byteReaderImpl{b}
|
||||
}
|
||||
t, err := quicvarint.ReadVarInt(br)
|
||||
t, err := quicvarint.Read(br)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
l, err := quicvarint.ReadVarInt(br)
|
||||
l, err := quicvarint.Read(br)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ type dataFrame struct {
|
|||
}
|
||||
|
||||
func (f *dataFrame) Write(b *bytes.Buffer) {
|
||||
quicvarint.WriteVarInt(b, 0x0)
|
||||
quicvarint.WriteVarInt(b, f.Length)
|
||||
quicvarint.Write(b, 0x0)
|
||||
quicvarint.Write(b, f.Length)
|
||||
}
|
||||
|
||||
type headersFrame struct {
|
||||
|
@ -81,8 +81,8 @@ type headersFrame struct {
|
|||
}
|
||||
|
||||
func (f *headersFrame) Write(b *bytes.Buffer) {
|
||||
quicvarint.WriteVarInt(b, 0x1)
|
||||
quicvarint.WriteVarInt(b, f.Length)
|
||||
quicvarint.Write(b, 0x1)
|
||||
quicvarint.Write(b, f.Length)
|
||||
}
|
||||
|
||||
const settingDatagram = 0x276
|
||||
|
@ -107,11 +107,11 @@ func parseSettingsFrame(r io.Reader, l uint64) (*settingsFrame, error) {
|
|||
b := bytes.NewReader(buf)
|
||||
var readDatagram bool
|
||||
for b.Len() > 0 {
|
||||
id, err := quicvarint.ReadVarInt(b)
|
||||
id, err := quicvarint.Read(b)
|
||||
if err != nil { // should not happen. We allocated the whole frame already.
|
||||
return nil, err
|
||||
}
|
||||
val, err := quicvarint.ReadVarInt(b)
|
||||
val, err := quicvarint.Read(b)
|
||||
if err != nil { // should not happen. We allocated the whole frame already.
|
||||
return nil, err
|
||||
}
|
||||
|
@ -140,21 +140,21 @@ func parseSettingsFrame(r io.Reader, l uint64) (*settingsFrame, error) {
|
|||
}
|
||||
|
||||
func (f *settingsFrame) Write(b *bytes.Buffer) {
|
||||
quicvarint.WriteVarInt(b, 0x4)
|
||||
quicvarint.Write(b, 0x4)
|
||||
var l protocol.ByteCount
|
||||
for id, val := range f.other {
|
||||
l += quicvarint.VarIntLen(id) + quicvarint.VarIntLen(val)
|
||||
l += quicvarint.Len(id) + quicvarint.Len(val)
|
||||
}
|
||||
if f.Datagram {
|
||||
l += quicvarint.VarIntLen(settingDatagram) + quicvarint.VarIntLen(1)
|
||||
l += quicvarint.Len(settingDatagram) + quicvarint.Len(1)
|
||||
}
|
||||
quicvarint.WriteVarInt(b, uint64(l))
|
||||
quicvarint.Write(b, uint64(l))
|
||||
if f.Datagram {
|
||||
quicvarint.WriteVarInt(b, settingDatagram)
|
||||
quicvarint.WriteVarInt(b, 1)
|
||||
quicvarint.Write(b, settingDatagram)
|
||||
quicvarint.Write(b, 1)
|
||||
}
|
||||
for id, val := range f.other {
|
||||
quicvarint.WriteVarInt(b, id)
|
||||
quicvarint.WriteVarInt(b, val)
|
||||
quicvarint.Write(b, id)
|
||||
quicvarint.Write(b, val)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue