Fix infinite loop in tcp reader for telemetry