Whilst reviewing #392 I notice that there is a potential for a CPU core to get locked into a tight loop. If the TCP socket fails (or is restarted) whilst reading bytes then the read call would return 0 bytes read.
This could result in a tight loop and locking up of a CPU core as the number of bytes read would never reach the total expected, and there is no timeout in the loop.