From 35ca862025fa14065d4ebed761783de225cb6690 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 5 Apr 2017 13:38:17 +0200 Subject: [PATCH] ws2_32: Use register_async for WS2_async_send. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/ws2_32/socket.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 2a957ce4d7a..22ff4797f8c 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -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_len = sendBufLen; - SERVER_START_REQ( register_async ) - { - 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; - + status = register_async( ASYNC_TYPE_WRITE, wsa->hSocket, WS2_async_send, wsa, ov->hEvent, + NULL, (void *)cvalue, iosb ); if (status != STATUS_PENDING) HeapFree(GetProcessHeap(), 0, wsa); /* 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->Information = n == -1 ? 0 : n; - SERVER_START_REQ( register_async ) - { - 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( lpCompletionRoutine ? 0 : lpOverlapped->hEvent ); - req->async.cvalue = cvalue; - err = wine_server_call( req ); - } - SERVER_END_REQ; + if (wsa->completion_func) + err = register_async( ASYNC_TYPE_WRITE, wsa->hSocket, WS2_async_send, wsa, NULL, + ws2_async_apc, wsa, iosb ); + else + err = register_async( ASYNC_TYPE_WRITE, wsa->hSocket, WS2_async_send, wsa, lpOverlapped->hEvent, + NULL, (void *)cvalue, iosb ); /* Enable the event only after starting the async. The server will deliver it as soon as the async is done. */ -- 2.11.4.GIT