-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add Windows support #168
Add Windows support #168
Conversation
This commit adds Windows support to this package. Since polling already has Windows support through IOCP, the main obstacle was adding a ping event source using IOCP. The hardest part is emulating a pipe using some shared state and a posted completion packet. Fixes #160 Signed-off-by: John Nunley <[email protected]>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #168 +/- ##
==========================================
- Coverage 86.43% 86.30% -0.14%
==========================================
Files 16 16
Lines 2012 2044 +32
==========================================
+ Hits 1739 1764 +25
- Misses 273 280 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
src/io.rs
Outdated
let _ = fcntl_setfl( | ||
let _ = set_nonblocking( | ||
unsafe { BorrowedFd::borrow_raw(self.dispatcher.borrow().fd) }, | ||
self.old_flags, | ||
false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a slight change in behavior. Currently, if the the FD was already in non-block mode before being wrapped into an Async<_>
, this is preserved on drop. While with this change, the FD is unconditionally set to blocking mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing with Windows is that it's impossible to tell whether or not a socket is currently in nonblocking mode. The socket can be set to blocking or non-blocking mode, but there is no way to tell what it currently is (without trying to perform a read of course).
So this behavior can't really be ported to Windows. I think the best course of action is to keep the current behavior on Unix, but on Windows to only ever set it to blocking mode.
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
This commit adds Windows support to this package. Since polling already
has Windows support through IOCP, the main obstacle was adding a ping
event source using IOCP. The hardest part is emulating a pipe using some
shared state and a posted completion packet.
Fixes #161