server: Also return STATUS_PIPE_DISCONNECTED for shutdown nonblocking sockets.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-07-26 11:53:42 -05:00 committed by Alexandre Julliard
parent 451a54bc7a
commit a9ddbc0cbc
2 changed files with 9 additions and 7 deletions

View File

@ -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);

View File

@ -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 )))
{