ws2_32: Use register_async for WS2_async_send.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-04-05 13:38:17 +02:00 committed by Alexandre Julliard
parent 57e93b72bb
commit 35ca862025
1 changed files with 8 additions and 25 deletions

View File

@ -3592,19 +3592,8 @@ static BOOL WINAPI WS2_ConnectEx(SOCKET s, const struct WS_sockaddr* name, int n
wsa->iovec[0].iov_base = sendBuf; wsa->iovec[0].iov_base = sendBuf;
wsa->iovec[0].iov_len = sendBufLen; wsa->iovec[0].iov_len = sendBufLen;
SERVER_START_REQ( register_async ) status = register_async( ASYNC_TYPE_WRITE, wsa->hSocket, WS2_async_send, wsa, ov->hEvent,
{ NULL, (void *)cvalue, iosb );
req->type = ASYNC_TYPE_WRITE;
req->async.handle = wine_server_obj_handle( wsa->hSocket );
req->async.callback = wine_server_client_ptr( WS2_async_send );
req->async.iosb = wine_server_client_ptr( iosb );
req->async.arg = wine_server_client_ptr( wsa );
req->async.event = wine_server_obj_handle( ov->hEvent );
req->async.cvalue = cvalue;
status = wine_server_call( req );
}
SERVER_END_REQ;
if (status != STATUS_PENDING) HeapFree(GetProcessHeap(), 0, wsa); if (status != STATUS_PENDING) HeapFree(GetProcessHeap(), 0, wsa);
/* If the connect already failed */ /* If the connect already failed */
@ -5609,18 +5598,12 @@ static int WS2_sendto( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
iosb->u.Status = STATUS_PENDING; iosb->u.Status = STATUS_PENDING;
iosb->Information = n == -1 ? 0 : n; iosb->Information = n == -1 ? 0 : n;
SERVER_START_REQ( register_async ) if (wsa->completion_func)
{ err = register_async( ASYNC_TYPE_WRITE, wsa->hSocket, WS2_async_send, wsa, NULL,
req->type = ASYNC_TYPE_WRITE; ws2_async_apc, wsa, iosb );
req->async.handle = wine_server_obj_handle( wsa->hSocket ); else
req->async.callback = wine_server_client_ptr( WS2_async_send ); err = register_async( ASYNC_TYPE_WRITE, wsa->hSocket, WS2_async_send, wsa, lpOverlapped->hEvent,
req->async.iosb = wine_server_client_ptr( iosb ); NULL, (void *)cvalue, iosb );
req->async.arg = wine_server_client_ptr( wsa );
req->async.event = wine_server_obj_handle( lpCompletionRoutine ? 0 : lpOverlapped->hEvent );
req->async.cvalue = cvalue;
err = wine_server_call( req );
}
SERVER_END_REQ;
/* Enable the event only after starting the async. The server will deliver it as soon as /* Enable the event only after starting the async. The server will deliver it as soon as
the async is done. */ the async is done. */