Fix D++ from stalling for a second before sending REST requests on Windows OS #1484
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Quite a while ago i noticed an issue that makes windows D++ builds delay sending messages, responses, and other REST requests with 1000ms delay. This PR fixes that.
Basically i added a dummy socket into poll implementation so that when poll() is running and waiting for timeout it can be interrupted by event of that dummy socket and refresh its file descriptors on demand.
To properly test this, increase poll timeout to 5000 ms and try simple ping-pong example bot. Before this change bot would hang for 5s and only then reply. Or slightly faster if heartbeat event occurs, which triggers poll activation. Issue persisted on all platforms when using default poll socket engine, both Linux and Windows.
Feel free to pinpoint in flaws that i may missed or request changes.
(they are as documented as they were before me)