mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
Revert "Io.Threaded: remove WSA_FLAG_OVERLAPPED from socket call"
The stated reason for this commit was cancelation didn't work. On
further review, we know why cancelation didn't work, and recent
enhancements on master branch make it easy to make it work.
Meanwhile, not using overlapped means that multiple threads cannot use
the same open socket handle. I also added line comments to explain the
choice in this revert commit.
This reverts commit fd3657bf8c.
closes #31011
reopens #30865
This commit is contained in:
@@ -11025,7 +11025,11 @@ fn openSocketWsa(
|
||||
) !ws2_32.SOCKET {
|
||||
const mode = posixSocketMode(options.mode);
|
||||
const protocol = posixProtocol(options.protocol);
|
||||
const flags: u32 = ws2_32.WSA_FLAG_NO_HANDLE_INHERIT;
|
||||
// WSA_FLAG_OVERLAPPED is chosen here because without this different
|
||||
// threads cannot use the same open socket handle.
|
||||
// TODO: the below code needs to use the AlertableSyscall mechanism instead in
|
||||
// order to make cancelation work.
|
||||
const flags: u32 = ws2_32.WSA_FLAG_OVERLAPPED | ws2_32.WSA_FLAG_NO_HANDLE_INHERIT;
|
||||
var syscall: Syscall = try .start();
|
||||
while (true) {
|
||||
const rc = ws2_32.WSASocketW(family, @bitCast(mode), @bitCast(protocol), null, 0, flags);
|
||||
|
||||
Reference in New Issue
Block a user