From 3e9e361f825de4abef3b730461dd523600f59622 Mon Sep 17 00:00:00 2001 From: Galen Wright-Watson Date: Fri, 14 Dec 2018 15:19:10 -0800 Subject: [PATCH] Fix: bug #220. MacGDBp hangs while debugging. Cause: empty chunk causes network reader to create packet early, and then add packet length as packet content. Soln: skip empty chunks. --- Source/NetworkConnection.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/NetworkConnection.mm b/Source/NetworkConnection.mm index 74ae3ac..6c4e307 100644 --- a/Source/NetworkConnection.mm +++ b/Source/NetworkConnection.mm @@ -333,6 +333,12 @@ - (void)readStreamHasData:(CFReadStreamRef)stream NSUInteger partLength = 0; for (CFIndex i = bufferOffset; i < bytesRead && charBuffer[i] != '\0'; ++i, ++partLength) ; + // FIX: bug #220 + if (partLength < 1) { + ++bufferOffset; + continue; + } + // If there is not a current packet, set some state. if (!self.currentPacket) { // Read the message header: the size. This will be |partLength| bytes. --