1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-22 03:20:30 +08:00

add crc chksum

This commit is contained in:
源文雨
2022-05-15 19:37:34 +08:00
parent f08253bd45
commit d854e0096c
2 changed files with 15 additions and 3 deletions

View File

@@ -15,7 +15,13 @@ func (l *Link) Read() *head.Packet {
}
func (m *Me) wait(data []byte) *head.Packet {
if len(data) < 60 { // not a valid packet
return nil
}
flags := binary.LittleEndian.Uint16(data[10:12])
if flags&0x8000 == 0x8000 { // not a valid packet
return nil
}
logrus.Debugln("[recv]", len(data), "bytes data with flag", hex.EncodeToString(data[10:12]))
if flags == 0 || flags == 0x4000 {
h := head.SelectPacket()