mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 06:12:59 +00:00
[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
svn path=/trunk/; revision=74673
This commit is contained in:
parent
1c9d856e91
commit
fb1a1ab85e
1 changed files with 4 additions and 3 deletions
|
@ -677,15 +677,16 @@ WSPCloseSocket(IN SOCKET Handle,
|
||||||
if (lpErrno) *lpErrno = WSAENOTSOCK;
|
if (lpErrno) *lpErrno = WSAENOTSOCK;
|
||||||
return SOCKET_ERROR;
|
return SOCKET_ERROR;
|
||||||
}
|
}
|
||||||
/* Set the state to close */
|
|
||||||
OldState = Socket->SharedData->State;
|
|
||||||
Socket->SharedData->State = SocketClosed;
|
|
||||||
|
|
||||||
/* Decrement reference count on SharedData */
|
/* Decrement reference count on SharedData */
|
||||||
References = InterlockedDecrement(&Socket->SharedData->RefCount);
|
References = InterlockedDecrement(&Socket->SharedData->RefCount);
|
||||||
if (References)
|
if (References)
|
||||||
goto ok;
|
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 */
|
/* If SO_LINGER is ON and the Socket is connected, we need to disconnect */
|
||||||
/* FIXME: Should we do this on Datagram Sockets too? */
|
/* FIXME: Should we do this on Datagram Sockets too? */
|
||||||
if ((OldState == SocketConnected) && (Socket->SharedData->LingerData.l_onoff))
|
if ((OldState == SocketConnected) && (Socket->SharedData->LingerData.l_onoff))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue