Module: wine Branch: master Commit: e6fee3596d5739f947a4909195fd1d5579def081 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e6fee3596d5739f947a4909195...
Author: Mike Kaplinskiy mike.kaplinskiy@gmail.com Date: Mon Jan 24 00:19:06 2011 -0500
ws2_32: Allow sending FD_WRITE right after scheduling the async.
The server won't actually send the event until the request is done.
---
dlls/ws2_32/socket.c | 26 ++++++++++---------------- 1 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index f7607c5..43d4598 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1793,26 +1793,16 @@ static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS statu
if (result >= 0) { - int totalLength = 0; - unsigned int i; status = STATUS_SUCCESS; - for (i = 0; i < wsa->n_iovecs; i++) - totalLength += wsa->iovec[i].iov_len; - if (result < totalLength) - _enable_event( wsa->hSocket, FD_WRITE, 0, 0 ); + } + else if (errno == EINTR || errno == EAGAIN) + { + status = STATUS_PENDING; } else { - if (errno == EINTR || errno == EAGAIN) - { - status = STATUS_PENDING; - _enable_event( wsa->hSocket, FD_WRITE, 0, 0 ); - } - else - { - status = wsaErrStatus(); - result = 0; - } + status = wsaErrStatus(); + result = 0; } break; } @@ -3922,6 +3912,10 @@ static int WS2_sendto( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, } SERVER_END_REQ;
+ /* Enable the event only after starting the async. The server will deliver it as soon as + the async is done. */ + _enable_event(SOCKET2HANDLE(s), FD_WRITE, 0, 0); + if (err != STATUS_PENDING) HeapFree( GetProcessHeap(), 0, wsa ); WSASetLastError( NtStatusToWSAError( err )); return SOCKET_ERROR;