https://bugs.winehq.org/show_bug.cgi?id=52474
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|ws2_32:sock fails |ws2_32:sock - |intermittently - 'Test |test_connect() fails |failed: expected timeout' |intermittently with 'Test | |failed: expected timeout' CC| |z.figura12@gmail.com
--- Comment #2 from Zeb Figura z.figura12@gmail.com --- So I find the explanation plausible enough to just assume it's correct.
The documentation [1] has this to say:
"The socket's internal record of network events is copied to the structure referenced by lpNetworkEvents, whereafter the internal network events record is cleared. If hEventObject is non-null, the indicated event object is also reset. The Windows Sockets provider guarantees that the operations of copying the network event record, clearing it, and resetting any associated event object are atomic, such that the next occurrence of a nominated network event will cause the event object to become set."
We can't "just" make this atomic, but on the other hand, we're building on top of an actual undocumented AFD API. I played with this a bit and discovered, to my chagrin, that IOCTL_AFD_GET_EVENTS does support resetting an event. Trouble is, it's done like this:
NtDeviceIoControlFile((HANDLE)socket, NULL, NULL, NULL, &io, IOCTL_AFD_GET_EVENTS, event, 0, ¶ms, sizeof(params));
i.e. with the event passed *as* a pointer.
This is not impossible to support, but the translation will have to be done in ntdll.
[1] https://learn.microsoft.com/en-us/windows/win32/api/ws2spi/nc-ws2spi-lpwspen...