Zebediah Figura : server: Poll for FD_CLOSE even if we cannot receive more data.

Alexandre Julliard julliard at winehq.org
Fri May 14 15:47:04 CDT 2021


Module: wine
Branch: master
Commit: aa6b2482ccf08a699e14d00aad2e2ffd040218dd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=aa6b2482ccf08a699e14d00aad2e2ffd040218dd

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu May 13 22:54:35 2021 -0500

server: Poll for FD_CLOSE even if we cannot receive more data.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ws2_32/tests/sock.c | 6 +++---
 server/sock.c            | 3 +--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 266ddc14451..9116c2b169d 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -4455,12 +4455,12 @@ static void test_close_events(struct event_test_ctx *ctx)
     check_events(ctx, 0, 0, 0);
     select_events(ctx, server, FD_ACCEPT | FD_CLOSE | FD_CONNECT | FD_OOB | FD_READ);
     if (ctx->is_message)
-        check_events_todo_msg(ctx, FD_CLOSE, 0, 200);
+        check_events(ctx, FD_CLOSE, 0, 200);
     check_events(ctx, 0, 0, 0);
     select_events(ctx, server, 0);
     select_events(ctx, server, FD_ACCEPT | FD_CLOSE | FD_CONNECT | FD_OOB | FD_READ);
     if (ctx->is_message)
-        check_events_todo_msg(ctx, FD_CLOSE, 0, 200);
+        check_events(ctx, FD_CLOSE, 0, 200);
     check_events(ctx, 0, 0, 0);
 
     ret = recv(server, buffer, 5, 0);
@@ -4553,7 +4553,7 @@ static void test_close_events(struct event_test_ctx *ctx)
 
     check_events(ctx, 0, 0, 200);
     select_events(ctx, server, FD_ACCEPT | FD_CLOSE | FD_CONNECT | FD_OOB | FD_READ);
-    check_events_todo_event(ctx, FD_CLOSE, 0, 200);
+    check_events_todo(ctx, FD_CLOSE, 0, 200);
 
     closesocket(server);
 }
diff --git a/server/sock.c b/server/sock.c
index c8cd603149b..92202d317c4 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -786,8 +786,7 @@ static int sock_get_poll_events( struct fd *fd )
     else if (smask & FD_READ || (sock->state & FD_WINE_LISTENING && mask & FD_ACCEPT))
         ev |= POLLIN | POLLPRI;
     /* We use POLLIN with 0 bytes recv() as FD_CLOSE indication for stream sockets. */
-    else if (sock->type == WS_SOCK_STREAM && (sock->state & FD_READ) && (mask & FD_CLOSE) &&
-              !(sock->reported_events & FD_READ))
+    else if (sock->type == WS_SOCK_STREAM && (mask & FD_CLOSE) && !(sock->reported_events & FD_READ))
         ev |= POLLIN;
 
     if (async_queued( &sock->write_q ))




More information about the wine-cvs mailing list