Commit 27b51ce6 authored by Mike Kaplinskiy's avatar Mike Kaplinskiy Committed by Alexandre Julliard

ws2_32: Finish an overlapped send only if we sent everything.

parent a06144d9
......@@ -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 )
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment