Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket: select returns 1 when the socket is closed #19

Closed
wants to merge 1 commit into from
Closed

socket: select returns 1 when the socket is closed #19

wants to merge 1 commit into from

Conversation

AiXanadu
Copy link

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.

@nikias
Copy link
Member

nikias commented Mar 29, 2022

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...

@AiXanadu
Copy link
Author

You can check out the latter commit, which is a temporary solution and is closed.

@nikias
Copy link
Member

nikias commented Apr 19, 2022

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.

@AiXanadu
Copy link
Author

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.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants