You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix reporting refused connections with StreamSelectLoop on Windows
We do not usually use or expose the `exceptfds` parameter passed to the
underlying `select`. However, Windows does not report failed connection
attempts in `writefds` passed to `select` like most other platforms.
Instead, it uses `writefds` only for successful connection attempts and
`exceptfds` for failed connection attempts. See also
https://docs.microsoft.com/de-de/windows/win32/api/winsock2/nf-winsock2-select
We work around this by adding all sockets that look like a pending
connection attempt to `exceptfds` automatically on Windows and merge it
back later. This ensures the public API matches other loop
implementations across all platforms (see also test suite or rather test
matrix). Lacking better APIs, every write-only socket that has not yet
read any data is assumed to be in a pending connection attempt state.
// We do not usually use or expose the `exceptfds` parameter passed to the underlying `select`.
273
+
// However, Windows does not report failed connection attempts in `writefds` passed to `select` like most other platforms.
274
+
// Instead, it uses `writefds` only for successful connection attempts and `exceptfds` for failed connection attempts.
275
+
// We work around this by adding all sockets that look like a pending connection attempt to `exceptfds` automatically on Windows and merge it back later.
276
+
// This ensures the public API matches other loop implementations across all platforms (see also test suite or rather test matrix).
277
+
// Lacking better APIs, every write-only socket that has not yet read any data is assumed to be in a pending connection attempt state.
0 commit comments