Correct 2 bugs connected to asynchronous shutdown():
- Cannot call WSAGetOverlappedResult() because completion function destroys the overlapped structure. - ws2_async_cleanup() called twice in case of failure.
This commit is contained in:
parent
b5fc589f44
commit
4577875c4e
|
@ -1376,15 +1376,11 @@ static int WS2_register_async_shutdown ( SOCKET s, int fd, int type )
|
|||
if ( (ret = register_new_async ( &wsa->async )) )
|
||||
{
|
||||
err = NtStatusToWSAError ( ret );
|
||||
ws2_async_cleanup ( &wsa->async );
|
||||
goto out;
|
||||
}
|
||||
/* Try immediate completion */
|
||||
if ( WSAGetOverlappedResult ( s, ovl, NULL, FALSE, NULL ) )
|
||||
while ( WaitForSingleObjectEx ( ovl->hEvent, 0, TRUE ) == STATUS_USER_APC );
|
||||
return 0;
|
||||
if ( (err = WSAGetLastError ()) == WSA_IO_INCOMPLETE )
|
||||
return 0;
|
||||
return WSAEINVAL;
|
||||
|
||||
out_close:
|
||||
WSACloseEvent ( ovl->hEvent );
|
||||
|
|
Loading…
Reference in New Issue