server: Always wake up pending read or write asyncs on POLLHUP or POLLERR.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52815
This commit is contained in:
Zebediah Figura 2022-04-28 21:40:46 -05:00 committed by Alexandre Julliard
parent 07b66768b1
commit f234341ca1
2 changed files with 18 additions and 20 deletions

View file

@ -7018,12 +7018,12 @@ static void test_WSARecv(void)
close_with_rst(src);
dwret = WaitForSingleObject(ov.hEvent, 1000);
todo_wine ok(dwret == WAIT_OBJECT_0, "Waiting for disconnect event failed with %ld + errno %ld\n", dwret, GetLastError());
ok(dwret == WAIT_OBJECT_0, "Waiting for disconnect event failed with %ld + errno %ld\n", dwret, GetLastError());
bret = GetOverlappedResult((HANDLE)dest, &ov, &bytesReturned, FALSE);
ok(!bret, "expected failure\n");
todo_wine ok(GetLastError() == ERROR_NETNAME_DELETED, "got error %lu\n", GetLastError());
todo_wine ok(bytesReturned == 0, "Bytes received is %ld\n", bytesReturned);
ok(GetLastError() == ERROR_NETNAME_DELETED, "got error %lu\n", GetLastError());
ok(bytesReturned == 0, "Bytes received is %ld\n", bytesReturned);
closesocket(dest);
dest = INVALID_SOCKET;
@ -9669,10 +9669,10 @@ static void test_completion_port(void)
bret = GetQueuedCompletionStatus(io_port, &num_bytes, &key, &olp, 100);
ok(bret == FALSE, "GetQueuedCompletionStatus returned %d\n", bret);
todo_wine ok(GetLastError() == ERROR_NETNAME_DELETED, "Last error was %ld\n", GetLastError());
todo_wine ok(key == 125, "Key is %Iu\n", key);
todo_wine ok(num_bytes == 0, "Number of bytes received is %lu\n", num_bytes);
todo_wine ok(olp == &ov, "Overlapped structure is at %p\n", olp);
ok(GetLastError() == ERROR_NETNAME_DELETED, "Last error was %ld\n", GetLastError());
ok(key == 125, "Key is %Iu\n", key);
ok(num_bytes == 0, "Number of bytes received is %lu\n", num_bytes);
ok(olp == &ov, "Overlapped structure is at %p\n", olp);
SetLastError(0xdeadbeef);
key = 0xdeadbeef;
@ -9721,10 +9721,10 @@ static void test_completion_port(void)
bret = GetQueuedCompletionStatus( io_port, &num_bytes, &key, &olp, 200 );
ok(bret == FALSE, "GetQueuedCompletionStatus returned %u\n", bret );
todo_wine ok(GetLastError() == WAIT_TIMEOUT, "Last error was %ld\n", GetLastError());
todo_wine ok(key == 0xdeadbeef, "Key is %Iu\n", key);
todo_wine ok(num_bytes == 0xdeadbeef, "Number of bytes transferred is %lu\n", num_bytes);
todo_wine ok(!olp, "Overlapped structure is at %p\n", olp);
ok(GetLastError() == WAIT_TIMEOUT, "Last error was %ld\n", GetLastError());
ok(key == 0xdeadbeef, "Key is %Iu\n", key);
ok(num_bytes == 0xdeadbeef, "Number of bytes transferred is %lu\n", num_bytes);
ok(!olp, "Overlapped structure is at %p\n", olp);
if (dest != INVALID_SOCKET)
closesocket(dest);
@ -12851,12 +12851,12 @@ static void test_tcp_reset(void)
close_with_rst(server);
ret = WaitForSingleObject(overlapped.hEvent, 1000);
todo_wine ok(!ret, "wait failed\n");
ok(!ret, "wait failed\n");
ret = GetOverlappedResult((HANDLE)client, &overlapped, &size, FALSE);
ok(!ret, "expected failure\n");
todo_wine ok(GetLastError() == ERROR_NETNAME_DELETED, "got error %lu\n", GetLastError());
todo_wine ok(!size, "got size %lu\n", size);
todo_wine ok((NTSTATUS)overlapped.Internal == STATUS_CONNECTION_RESET, "got status %#lx\n", (NTSTATUS)overlapped.Internal);
ok(GetLastError() == ERROR_NETNAME_DELETED, "got error %lu\n", GetLastError());
ok(!size, "got size %lu\n", size);
ok((NTSTATUS)overlapped.Internal == STATUS_CONNECTION_RESET, "got status %#lx\n", (NTSTATUS)overlapped.Internal);
len = sizeof(error);
ret = getsockopt(client, SOL_SOCKET, SO_ERROR, (char *)&error, &len);
@ -12868,7 +12868,7 @@ static void test_tcp_reset(void)
WSASetLastError(0xdeadbeef);
size = 0xdeadbeef;
ret = WSARecv(client, &wsabuf, 1, &size, &flags, &overlapped, NULL);
ok(ret == -1, "got %d\n", ret);
todo_wine ok(ret == -1, "got %d\n", ret);
todo_wine ok(WSAGetLastError() == WSAECONNRESET, "got error %u\n", WSAGetLastError());
check_poll_todo(client, POLLERR | POLLHUP | POLLWRNORM);

View file

@ -1046,10 +1046,8 @@ static int sock_dispatch_asyncs( struct sock *sock, int event, int error )
int status = sock_get_ntstatus( error );
struct accept_req *req, *next;
if (sock->rd_shutdown || sock->hangup)
async_wake_up( &sock->read_q, status );
if (sock->wr_shutdown)
async_wake_up( &sock->write_q, status );
async_wake_up( &sock->read_q, status );
async_wake_up( &sock->write_q, status );
LIST_FOR_EACH_ENTRY_SAFE( req, next, &sock->accept_list, struct accept_req, entry )
{