From f8bd390e426e31088d4280e492f1ced3e6294aee Mon Sep 17 00:00:00 2001 From: Jonas Falck Date: Tue, 22 Nov 2022 20:10:42 +0100 Subject: [PATCH] Fix bug with not reading whole packets --- packetstream.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packetstream.go b/packetstream.go index 7c313c1..1c63502 100644 --- a/packetstream.go +++ b/packetstream.go @@ -46,14 +46,14 @@ func (w *packetStream) readPackets(ctx context.Context) { if length > 0 { packet := make([]byte, length) - i, err := w.stream.Read(packet) + i, err := io.ReadFull(w.stream, packet) if err != nil { w.logger.Errorf("Failed to read packet: %s", err) continue } if i != int(length) { - w.logger.Errorf("Invalid packet size. Wanted: %d Read: %d Data: %s", length, i, string(packet)) + w.logger.Errorf("Invalid packet size. Wanted: %d Read: %d Data: %s ... (capped)", length, i, string(packet[:500])) continue }