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