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

Windows async networking #10115

Closed
wants to merge 13 commits into from
Closed

Conversation

Sashiri
Copy link

@Sashiri Sashiri commented Nov 7, 2021

  • Ignores unknown errors in windows GetQueuedCompletionStatus logic
  • Adds kernel32.GetFileType function and FileType enum, for fd checking
  • Adds WSA_FLAG_OVERLAPPED to socket if requesting SOCK.NONBLOCK in windows
  • Adds listening socket to IOCP if io_mode is .evented
  • Fixes windows WriteFile and ReadFile for sockets, by ignoring offset and SetFilePointerEx calls if fd is a pipe device
  • Adds and calls windows.acceptEx from os.accept if io_mode is .evented

lib/std/os/windows.zig Show resolved Hide resolved
lib/std/net.zig Show resolved Hide resolved
@Sashiri Sashiri closed this Jan 15, 2022
@Sashiri Sashiri deleted the windows_async_networking branch March 3, 2022 22:42
@Sashiri Sashiri restored the windows_async_networking branch March 20, 2022 15:14
@gajanak
Copy link

gajanak commented Mar 22, 2022

@Sashiri #10115

Thanks.. i dont found your branch/PR - and implement it (first-try experimental) in the same way by myself.
I know this works, with current Loop design. Where was your show stopper ?
Wouldn't it a alternative to get this in std, to get working NetServer on windows if io_mode=.eventd until Loop is redesigned later?
But I used WSARecv and WSASend For networki IO, dont try to get file and network the same IO, which is sadly not the windows-way. I don't change ReadFile and WriteFile , removing complexity.

@Sashiri
Copy link
Author

Sashiri commented Mar 22, 2022

I was unhappy with the quality and possible future maintenance of code, for example GetQueuedCompletionStatus ignoring all errors which could be considered an antipattern for the current design of std. There're also multiple assumptions of socket and connection proto

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.

3 participants