net.cc (fdsock): Fix comment

This commit is contained in:
Corinna Vinschen 2015-12-15 18:12:49 +01:00
parent ba8d6a595a
commit 0f5afe895f

View File

@ -534,18 +534,15 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc)
SetHandleInformation. Subsequent socket calls in the child process fail SetHandleInformation. Subsequent socket calls in the child process fail
with error 10038, WSAENOTSOCK. with error 10038, WSAENOTSOCK.
The only way up to Windows Server 2003 to make these sockets usable in There's a neat way to workaround these annoying LSP sockets. WSAIoctl
child processes is to duplicate them via WSADuplicateSocket/WSASocket allows to fetch the underlying base socket, which is a normal, inheritable
calls. This requires to start the child process in SUSPENDED state so IFS handle. So we fetch the base socket, duplicate it, and close the
we only do this on affected systems. If we recognize a non-inheritable original socket. Now we have a standard IFS socket which (hopefully)
socket we switch to inheritance/dup via WSADuplicateSocket/WSASocket for works as expected.
that socket.
Starting with Vista there's another neat way to workaround these annoying If that doesn't work for some reason, mark the sockets for duplication
LSP sockets. WSAIoctl allows to fetch the underlying base socket, which via WSADuplicateSocket/WSASocket. This requires to start the child
is a normal, inheritable IFS handle. So we fetch the base socket, process in SUSPENDED state so we only do this if really necessary. */
duplicate it, and close the original socket. Now we have a standard IFS
socket which (hopefully) works as expected. */
DWORD flags; DWORD flags;
bool fixup = false; bool fixup = false;
if (!GetHandleInformation ((HANDLE) soc, &flags) if (!GetHandleInformation ((HANDLE) soc, &flags)