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

Add Windows support #168

Merged
merged 10 commits into from
Jan 15, 2024
Merged

Add Windows support #168

merged 10 commits into from
Jan 15, 2024

Conversation

notgull
Copy link
Member

@notgull notgull commented Jan 13, 2024

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

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]>
Copy link

codecov bot commented Jan 13, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (67b9308) 86.43% compared to head (f756fd9) 86.30%.
Report is 1 commits behind head on master.

Files Patch % Lines
src/sources/generic.rs 50.00% 8 Missing ⚠️
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     
Flag Coverage Δ
macos-latest 85.39% <79.48%> (-0.13%) ⬇️
ubuntu-latest 85.85% <79.48%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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
Comment on lines 168 to 180
let _ = fcntl_setfl(
let _ = set_nonblocking(
unsafe { BorrowedFd::borrow_raw(self.dispatcher.borrow().fd) },
self.old_flags,
false,
Copy link
Member

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.

Copy link
Member Author

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]>
@notgull notgull merged commit 7789de0 into master Jan 15, 2024
11 of 13 checks passed
@notgull notgull mentioned this pull request Jan 15, 2024
@notgull notgull deleted the notgull/windows branch February 25, 2024 16:39
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.

Windows support
2 participants