Commit 74059d12 authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

ntdll: Don't call try_send before server call in sock_send.

Otherwise, try_send() call from sock_send() may race against try_send() call from async_send_proc(), shuffling the packet order. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52401Signed-off-by: 's avatarJinoh Kang <jinoh.kang.kr@gmail.com> Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 0ac256ea
......@@ -908,21 +908,12 @@ static NTSTATUS sock_send( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, voi
async->iov_cursor = 0;
async->sent_len = 0;
status = try_send( fd, async );
if (status != STATUS_SUCCESS && status != STATUS_DEVICE_NOT_READY)
{
release_fileio( &async->io );
return status;
}
if (status == STATUS_DEVICE_NOT_READY && force_async)
status = STATUS_PENDING;
status = force_async ? STATUS_PENDING : STATUS_DEVICE_NOT_READY;
SERVER_START_REQ( send_socket )
{
req->status = status;
req->total = async->sent_len;
req->total = 0;
req->async = server_async( handle, &async->io, event, apc, apc_user, iosb_client_ptr(io) );
status = wine_server_call( req );
wait_handle = wine_server_ptr_handle( reply->wait );
......
......@@ -8010,7 +8010,7 @@ static void test_shutdown(void)
WSASetLastError(0xdeadbeef);
ret = send(client, "test", 5, 0);
ok(ret == -1, "got %d\n", ret);
todo_wine ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ret = recv(server, buffer, sizeof(buffer), 0);
ok(!ret, "got %d\n", ret);
......@@ -8057,7 +8057,7 @@ static void test_shutdown(void)
WSASetLastError(0xdeadbeef);
ret = send(server, "test", 5, 0);
ok(ret == -1, "got %d\n", ret);
todo_wine ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
addrlen = sizeof(addr);
ret = getpeername(client, (struct sockaddr *)&addr, &addrlen);
......@@ -8107,7 +8107,7 @@ static void test_shutdown(void)
WSASetLastError(0xdeadbeef);
ret = send(client, "test", 5, 0);
ok(ret == -1, "got %d\n", ret);
todo_wine ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ret = recv(server, buffer, sizeof(buffer), 0);
ok(!ret, "got %d\n", ret);
......@@ -8125,7 +8125,7 @@ static void test_shutdown(void)
WSASetLastError(0xdeadbeef);
ret = send(server, "test", 5, 0);
ok(ret == -1, "got %d\n", ret);
todo_wine ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
addrlen = sizeof(addr);
ret = getpeername(client, (struct sockaddr *)&addr, &addrlen);
......@@ -8256,7 +8256,7 @@ static void test_shutdown(void)
WSASetLastError(0xdeadbeef);
ret = sendto(client, "test", 5, 0, (struct sockaddr *)&server_addr, sizeof(server_addr));
ok(ret == -1, "got %d\n", ret);
todo_wine ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
closesocket(client);
closesocket(server);
......@@ -8337,7 +8337,7 @@ static void test_DisconnectEx(void)
WSASetLastError(0xdeadbeef);
ret = send(client, "test", 5, 0);
ok(ret == -1, "expected failure\n");
todo_wine ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ret = recv(server, buffer, sizeof(buffer), 0);
ok(!ret, "got %d\n", ret);
......@@ -8391,7 +8391,7 @@ static void test_DisconnectEx(void)
WSASetLastError(0xdeadbeef);
ret = send(client, "test", 5, 0);
ok(ret == -1, "expected failure\n");
todo_wine ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ret = recv(server, buffer, sizeof(buffer), 0);
ok(!ret, "got %d\n", ret);
......
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