diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-11-23 17:50:14 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-11-23 17:50:14 +0300 |
commit | 27bbefdefd339676bee4238e996df70e89fcdfa1 (patch) | |
tree | 54a83e54cc0997621e6158beedb51a6a418245ea /winsup/cygwin/net.cc | |
parent | 013e402bfc6d661d5884cd65888be06fa6e19c4f (diff) |
* fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Add
socket handle value to debug output.
(fhandler_socket::fixup_after_fork): Ditto. Make new socket handle
OVERLAPPED, just as if it has been created with socket().
* net.cc (fdsock): Close duplicated socket and explain why. Disable
the entire WSADuplicateSocket test for now and explain why.
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r-- | winsup/cygwin/net.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index f9cb1de15..61a9157d0 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -510,17 +510,27 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc) The only way to make these sockets usable in child processes is to duplicate them via WSADuplicateSocket/WSASocket calls. This requires - some incredible amount of extra processing so we only do this on + to start the child process in SUSPENDED state so we only do this on affected systems. If we recognize a non-inheritable socket, or if the XP1_IFS_HANDLES flag is not set in a call to WSADuplicateSocket, we switch to inheritance/dup via WSADuplicateSocket/WSASocket for that socket. */ DWORD flags; +#if 0 + /* Disable checking for IFS handle for now. In theory, checking the fact + that the socket handle is not inheritable should be sufficient. */ WSAPROTOCOL_INFOW wpi; +#endif if (!GetHandleInformation ((HANDLE) soc, &flags) - || !(flags & HANDLE_FLAG_INHERIT) + || !(flags & HANDLE_FLAG_INHERIT)) +#if 0 || WSADuplicateSocketW (soc, GetCurrentProcessId (), &wpi) + /* dwProviderReserved contains the actual SOCKET value of the duplicated + socket. Close it or suffer a handle leak. Worse, one socket for each + connection remains in CLOSE_WAIT state. */ + || (closesocket ((SOCKET) wpi.dwProviderReserved), FALSE) || !(wpi.dwServiceFlags1 & XP1_IFS_HANDLES)) +#endif ((fhandler_socket *) fd)->init_fixup_before (); /* Raise default buffer sizes (instead of WinSock default 8K). |