Author: phater Date: Fri May 26 15:27:45 2017 New Revision: 74673 URL: http://svn.reactos.org/svn/reactos?rev=74673&view=rev Log: [MSAFD] Don't update shared state on close if we still have active references to the socket. Checked also by ws2_32:close API test CORE-12029
Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllmain.c?rev=74673&r1=74672&r2=74673&view=diff ============================================================================== --- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Fri May 26 15:27:45 2017 @@ -677,14 +677,15 @@ if (lpErrno) *lpErrno = WSAENOTSOCK; return SOCKET_ERROR; } - /* Set the state to close */ - OldState = Socket->SharedData->State; - Socket->SharedData->State = SocketClosed; /* Decrement reference count on SharedData */ References = InterlockedDecrement(&Socket->SharedData->RefCount); if (References) goto ok; + + /* Set the state to close */ + OldState = Socket->SharedData->State; + Socket->SharedData->State = SocketClosed; /* If SO_LINGER is ON and the Socket is connected, we need to disconnect */ /* FIXME: Should we do this on Datagram Sockets too? */