Commit 160eb74f authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

ntdll: Don't call try_recv before server call in sock_recv.

Otherwise, try_recv() call from sock_recv() may race against try_recv() call from async_recv_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 e5ce4fa9
......@@ -737,16 +737,8 @@ static NTSTATUS sock_recv( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, voi
}
}
status = try_recv( fd, async, &information );
if (status != STATUS_SUCCESS && status != STATUS_BUFFER_OVERFLOW && 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;
information = 0;
SERVER_START_REQ( recv_socket )
{
......
......@@ -7813,8 +7813,8 @@ static void test_shutdown(void)
WSASetLastError(0xdeadbeef);
ret = recv(server, buffer, sizeof(buffer), 0);
todo_wine ok(ret == -1, "got %d\n", ret);
todo_wine ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ok(ret == -1, "got %d\n", ret);
ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ret = send(server, "test", 5, 0);
ok(ret == 5, "got %d\n", ret);
......@@ -7908,8 +7908,8 @@ static void test_shutdown(void)
WSASetLastError(0xdeadbeef);
ret = recv(server, buffer, sizeof(buffer), 0);
todo_wine ok(ret == -1, "got %d\n", ret);
todo_wine ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
ok(ret == -1, "got %d\n", ret);
ok(WSAGetLastError() == WSAESHUTDOWN, "got error %u\n", WSAGetLastError());
WSASetLastError(0xdeadbeef);
ret = send(server, "test", 5, 0);
......
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