From a9ddbc0cbc7d10233ebd18a2fba95994621a3527 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 26 Jul 2021 11:53:42 -0500 Subject: [PATCH] server: Also return STATUS_PIPE_DISCONNECTED for shutdown nonblocking sockets. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/ws2_32/tests/sock.c | 10 +++++----- server/sock.c | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 41fcb5d9248..5f2a68e5073 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -7453,12 +7453,12 @@ static void test_shutdown(void) WSASetLastError(0xdeadbeef); ret = recv(client, buffer, sizeof(buffer), 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()); WSASetLastError(0xdeadbeef); ret = recv(client, buffer, sizeof(buffer), 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()); WSASetLastError(0xdeadbeef); ret = shutdown(server, SD_SEND); @@ -7513,7 +7513,7 @@ static void test_shutdown(void) WSASetLastError(0xdeadbeef); ret = recv(client, buffer, sizeof(buffer), 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()); WSASetLastError(0xdeadbeef); ret = send(client, "test", 5, 0); @@ -7577,7 +7577,7 @@ static void test_shutdown(void) WSASetLastError(0xdeadbeef); ret = WSARecv(client, &wsabuf, 1, &size, &flags, NULL, NULL); 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 = send(server, "test", 5, 0); ok(ret == 5, "got %d\n", ret); @@ -7649,7 +7649,7 @@ static void test_shutdown(void) WSASetLastError(0xdeadbeef); ret = recvfrom(server, buffer, sizeof(buffer), 0, NULL, NULL); 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 = sendto(client, "test", 5, 0, (struct sockaddr *)&server_addr, sizeof(server_addr)); ok(ret == 5, "got %d\n", ret); diff --git a/server/sock.c b/server/sock.c index cd77ff7bdca..e5b0e81ead2 100644 --- a/server/sock.c +++ b/server/sock.c @@ -3216,7 +3216,8 @@ DECL_HANDLER(recv_socket) status = STATUS_PENDING; } - if (status == STATUS_PENDING && sock->rd_shutdown) status = STATUS_PIPE_DISCONNECTED; + if ((status == STATUS_PENDING || status == STATUS_DEVICE_NOT_READY) && sock->rd_shutdown) + status = STATUS_PIPE_DISCONNECTED; sock->pending_events &= ~(req->oob ? AFD_POLL_OOB : AFD_POLL_READ); sock->reported_events &= ~(req->oob ? AFD_POLL_OOB : AFD_POLL_READ); @@ -3326,7 +3327,8 @@ DECL_HANDLER(send_socket) status = STATUS_PENDING; } - if (status == STATUS_PENDING && sock->wr_shutdown) status = STATUS_PIPE_DISCONNECTED; + if ((status == STATUS_PENDING || status == STATUS_DEVICE_NOT_READY) && sock->wr_shutdown) + status = STATUS_PIPE_DISCONNECTED; if ((async = create_request_async( fd, get_fd_comp_flags( fd ), &req->async ))) { -- 2.11.4.GIT