MCPcopy
hub / github.com/lonng/nano / forward

Method forward

internal/codec/codec.go:54–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52}
53
54func (c *Decoder) forward() error {
55 header := c.buf.Next(HeadLength)
56 c.typ = header[0]
57 if c.typ < packet.Handshake || c.typ > packet.Kick {
58 return packet.ErrWrongPacketType
59 }
60 c.size = bytesToInt(header[1:])
61
62 // packet length limitation
63 if c.size > MaxPacketSize {
64 return ErrPacketSizeExcced
65 }
66 return nil
67}
68
69// Decode decode the network bytes slice to packet.Packet(s)
70// TODO(Warning): shared slice

Callers 1

DecodeMethod · 0.95

Calls 1

bytesToIntFunction · 0.85

Tested by

no test coverage detected