This commit is contained in:
shoopea 2020-06-14 22:45:52 +02:00
parent 11c8aee2d4
commit 24470f01f1

12
main.go
View File

@ -46,19 +46,21 @@ func main() {
break break
} }
logInfoDebug("Waiting for full packet : len : %d / type : %d", p.PLength, p.PType) logInfoDebug("Waiting for packet data : len : %d / type : %d", p.PLength, p.PType)
for { for {
if read >= int(p.PLength) {
logInfoDebug("Data read")
break
}
n, err = r.Read(b[read:]) n, err = r.Read(b[read:])
logErrorDebug(err, "r.Read") logErrorDebug(err, "r.Read")
read += n read += n
logInfoDebug("Waiting for data, read %d/%d bytes.", read, p.PLength) logInfoDebug("Waiting for data, read %d/%d bytes.", read, p.PLength)
if read >= int(p.PLength) {
break
}
} }
logInfoDebug("Packet read : len : %d / type : %d", p.PLength, p.PType) logInfoDebug("Packet fully read : len : %d / type : %d", p.PLength, p.PType)
c := make([]byte, 0xFFFF) c := make([]byte, 0xFFFF)
copy(c, b[p.PLength:]) copy(c, b[p.PLength:])
b = c b = c