[PATCH 2/2] server: Reselect only after dequeueing async request.

Jinoh Kang jinoh.kang.kr at gmail.com
Mon Jan 3 13:56:27 CST 2022


Otherwise, async_waiting() returns 0, leading the socket object to
believe that the previous async request has not yet been acknowledged.
This results in I/O hang for subsequent reads (until shutdown).

Also, async_destroy() calls async_reselect() only after removing the
async request from the queue.  Make async_set_result() consistent with
this behaviour.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52332
Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
 dlls/ws2_32/tests/sock.c | 4 ----
 server/async.c           | 5 ++---
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 57ff496cfb8..85275a745de 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -11487,15 +11487,11 @@ static void test_simultaneous_async_recv(void)
         DWORD size;
 
         ret = WaitForSingleObject(events[i], 1000);
-        todo_wine_if(i > 0)
         ok(!ret, "wait timed out\n");
 
         ret = GetOverlappedResult((HANDLE)client, &overlappeds[i], &size, FALSE);
-        todo_wine_if(i > 0)
         ok(ret, "got error %u\n", GetLastError());
-        todo_wine_if(i > 0)
         ok(size == stride, "got size %u\n", size);
-        todo_wine_if(i > 0)
         ok(!memcmp(expect, actual, stride), "expected %s, got %s\n", debugstr_an(expect, stride), debugstr_an(actual, stride));
     }
 
diff --git a/server/async.c b/server/async.c
index 1a564ff1a69..7aef28355f0 100644
--- a/server/async.c
+++ b/server/async.c
@@ -509,12 +509,11 @@ void async_set_result( struct object *obj, unsigned int status, apc_param_t tota
             async->completion_callback( async->completion_callback_private );
         async->completion_callback = NULL;
 
-        async_reselect( async );
-
         if (async->queue)
         {
-            async->fd = NULL;
             list_remove( &async->queue_entry );
+            async_reselect( async );
+            async->fd = NULL;
             async->queue = NULL;
             release_object( async );
         }
-- 
2.31.1




More information about the wine-devel mailing list