Module: wine Branch: master Commit: 27b51ce6b06e5673259d6a4ac917c0847d49f4a0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=27b51ce6b06e5673259d6a4ac9...
Author: Mike Kaplinskiy mike.kaplinskiy@gmail.com Date: Mon Jan 24 00:19:25 2011 -0500
ws2_32: Finish an overlapped send only if we sent everything.
---
dlls/ws2_32/socket.c | 10 +++++++--- dlls/ws2_32/tests/sock.c | 4 +--- 2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 66def56..774481d 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1806,7 +1806,11 @@ static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS statu
if (result >= 0) { - status = STATUS_SUCCESS; + if (wsa->first_iovec < wsa->n_iovecs) + status = STATUS_PENDING; + else + status = STATUS_SUCCESS; + iosb->Information += result; } else if (errno == EINTR || errno == EAGAIN) @@ -3906,10 +3910,10 @@ static int WS2_sendto( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, wsa->completion_func = lpCompletionRoutine; release_sock_fd( s, fd );
- if (n == -1) + if (n == -1 || n < totalLength) { iosb->u.Status = STATUS_PENDING; - iosb->Information = 0; + iosb->Information = n == -1 ? 0 : n;
SERVER_START_REQ( register_async ) { diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 77925b5..df6bff8 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -2848,10 +2848,8 @@ static void test_send(void)
bytes_sent = 0; ret = WSASend(dst, &buf, 1, &bytes_sent, 0, &ov, NULL); - todo_wine ok((ret == SOCKET_ERROR && GetLastError() == ERROR_IO_PENDING) || broken(bytes_sent == buflen), + ok((ret == SOCKET_ERROR && GetLastError() == ERROR_IO_PENDING) || broken(bytes_sent == buflen), "Failed to start overlapped send %d - %d - %d/%d\n", ret, WSAGetLastError(), bytes_sent, buflen); - if ( (ret != SOCKET_ERROR || GetLastError() != ERROR_IO_PENDING) && bytes_sent < buflen ) - goto end;
/* don't check for completion yet, we may need to drain the buffer while still sending */ set_blocking(src, FALSE);