[MSAFD] Disable setting blocking mode if there are WSPAsyncSelect or WSPEventSelect pending calls. CORE-12104

svn path=/trunk/; revision=73120
This commit is contained in:
Peter Hater 2016-11-04 09:38:21 +00:00
parent 509c345083
commit 7f3c674aee

View file

@ -2264,6 +2264,22 @@ WSPIoctl(IN SOCKET Handle,
break;
}
NonBlocking = *((PULONG)lpvInBuffer) ? TRUE : FALSE;
/* Don't allow to go in blocking mode if WSPAsyncSelect or WSPEventSelect is pending */
if (!NonBlocking)
{
/* If there is an WSPAsyncSelect pending, fail with WSAEINVAL */
if (Socket->SharedData->AsyncEvents & (~Socket->SharedData->AsyncDisabledEvents))
{
Errno = WSAEINVAL;
break;
}
/* If there is an WSPEventSelect pending, fail with WSAEINVAL */
if (Socket->NetworkEvents)
{
Errno = WSAEINVAL;
break;
}
}
Socket->SharedData->NonBlocking = NonBlocking ? 1 : 0;
NeedsCompletion = FALSE;
Errno = SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &NonBlocking, NULL, NULL, lpOverlapped, lpCompletionRoutine);