test
This commit is contained in:
parent
362a8ea83b
commit
f6c99c60c3
7
main.go
7
main.go
@ -32,15 +32,20 @@ func main() {
|
|||||||
b, err = conn.ReadByte()
|
b, err = conn.ReadByte()
|
||||||
logErrorDebug(err, "conn.ReadByte")
|
logErrorDebug(err, "conn.ReadByte")
|
||||||
p.PType = uint8(b)
|
p.PType = uint8(b)
|
||||||
|
if p.PLength <= 3 {
|
||||||
|
logInfoAlert("Wrong packet length")
|
||||||
|
break
|
||||||
|
}
|
||||||
d := make([]byte, p.PLength-3)
|
d := make([]byte, p.PLength-3)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
_, err := conn.Read(d[len(d):])
|
_, err := conn.Read(d[len(d):])
|
||||||
logErrorDebug(err, "conn.Read")
|
logErrorDebug(err, "conn.Read")
|
||||||
if len(d) == p.PLength-3 {
|
if len(d) == int(p.PLength-3) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logInfoDebug("Packet read : len : %d / type : %d", p.PLength, p.PType)
|
logInfoDebug("Packet read : len : %d / type : %d", p.PLength, p.PType)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user