Closed AiXanadu closed 2 years ago
I get the point but I could measure a noticeable performance impact on the transfer speeds via USB. I need to find a different solution for this...
You can check out the latter commit, which is a temporary solution and is closed.
You're probably referring to #22. I want to check if there's a more elegant solution to this generic problem, but the new PR definitely makes it better.
You're quite right, the new changes are mainly due to the slowness of sending large amounts of filesystem data when restoring a device. So I added an actively set flag to let the user decide whether to enable this feature.
On Windows, when I quickly unplug the device. Sometimes it gets stuck in send(). The reason is that when the peer (driver) closes the socket, select returns a value of 1. So I use very little time to check if the current is readable. If the read data is less than or equal to 0, the socket is closed. We don't need to send, because continuing the operation will prevent the thread from returning and continue to consume CPU resources.