From 24470f01f1f603b5f5af45c7a5a4335c15f0a1dd Mon Sep 17 00:00:00 2001 From: shoopea Date: Sun, 14 Jun 2020 22:45:52 +0200 Subject: [PATCH] test --- main.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 7c63498..a875590 100644 --- a/main.go +++ b/main.go @@ -46,19 +46,21 @@ func main() { 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 { + if read >= int(p.PLength) { + logInfoDebug("Data read") + break + } n, err = r.Read(b[read:]) logErrorDebug(err, "r.Read") read += n 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) copy(c, b[p.PLength:]) b = c