On 2/21/23 11:40, Marc-André Lureau wrote:
Yes it likely can, the first SOCKET value starts at 92 in a simple
test. It looks like it may depend on the system number of opened
sockets.
I think the second big issue is that we have many places where we
assume a fd is a fd, and we simply call close() (which would result
in CloseHandle, but missing closesocket).
sigh, if the CRT would allow us to steal the handle back..
I found an interesting option here, using HANDLE_FLAG_PROTECT_FROM_CLOSE:
https://github.com/ksmurph1/VulkanConfigurator/blob/986992a8b963a6b271785a77d5efd349b6e6ea4f/src/folly/src/net/detail/SocketFileDescriptorMap.cpp#L36
Wow, that's the ugliest thing ever but it seems to be made for this. :)
Paolo