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

to_sleep_ms can be negative, causing SleepFor to wait for (almost) ever #34

Open
teub opened this issue Nov 27, 2021 · 0 comments
Open
Assignees

Comments

@teub
Copy link

teub commented Nov 27, 2021

Hello,

IsRightTime can set a negative value to to_sleep_until_next_delete_idle, causing the subsequent call to SleepFor to wait for a very long time on windows, and the process getting stuck when calling Stop(true) on the peer.
Indeed, Sleep((DWORD)time_ms) casts the negative value to a very large positive value.

I don't know if IsRightTime is buggy; a possible fix would be replacing "SleepFor(to_sleep_ms);" with "SleepFor(std::max((long)0, to_sleep_ms));", or maybe do the check in the function itself.

@truvorskameikin truvorskameikin self-assigned this Nov 29, 2021
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

No branches or pull requests

2 participants