Some fixes on async shutdown.

This commit is contained in:
Eric Pouech 2005-05-09 19:31:19 +00:00 committed by Alexandre Julliard
parent 5f0031eb3b
commit 0198255ba9
1 changed files with 7 additions and 4 deletions

View File

@ -1038,8 +1038,12 @@ static ULONG ws2_queue_async(struct ws2_async* wsa, IO_STATUS_BLOCK* iosb)
if ( status ) iosb->u.Status = status; if ( status ) iosb->u.Status = status;
if ( iosb->u.Status != STATUS_PENDING ) if ( iosb->u.Status != STATUS_PENDING )
{ {
(apc)( wsa, iosb, iosb->u.Status ); /* Note: we get here a non zero status when we couldn't queue the async
return iosb->u.Status; * in the server. Therefore, we simply terminate the async.
*/
status = iosb->u.Status;
ws2_async_terminate(wsa, iosb);
return status;
} }
NtCurrentTeb()->num_async_io++; NtCurrentTeb()->num_async_io++;
return STATUS_SUCCESS; return STATUS_SUCCESS;
@ -1349,7 +1353,7 @@ static int WS2_register_async_shutdown( SOCKET s, int fd, enum ws2_mode mode )
if ( !wsa ) if ( !wsa )
goto out_close; goto out_close;
/* Hack: this will cause ws2_async_cleanup() to free the overlapped structure */ /* Hack: this will cause ws2_async_terminate() to free the overlapped structure */
wsa->user_overlapped = NULL; wsa->user_overlapped = NULL;
if ( (ret = ws2_queue_async( wsa, iosb )) ) if ( (ret = ws2_queue_async( wsa, iosb )) )
{ {
@ -1363,7 +1367,6 @@ static int WS2_register_async_shutdown( SOCKET s, int fd, enum ws2_mode mode )
out_close: out_close:
WSACloseEvent( ovl->hEvent ); WSACloseEvent( ovl->hEvent );
out_free: out_free:
HeapFree( GetProcessHeap(), 0, iosb );
HeapFree( GetProcessHeap(), 0, ovl ); HeapFree( GetProcessHeap(), 0, ovl );
out: out:
return err; return err;