Zebediah Figura : server: Factor out a complete_async_poll() helper.

Alexandre Julliard julliard at winehq.org
Thu Sep 23 15:35:03 CDT 2021


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Thu Sep 23 00:48:02 2021 -0500

server: Factor out a complete_async_poll() helper.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/sock.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/server/sock.c b/server/sock.c
index fc234e89865..e426019d558 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -832,6 +832,12 @@ static int get_poll_flags( struct sock *sock, int event )
     return flags;
 }
 
+static void complete_async_poll( struct poll_req *req, unsigned int status )
+{
+    /* pass 0 as result; client will set actual result size */
+    async_request_complete( req->async, status, 0, req->count * sizeof(*req->output), req->output );
+}
+
 static void complete_async_polls( struct sock *sock, int event, int error )
 {
     int flags = get_poll_flags( sock, event );
@@ -855,8 +861,7 @@ static void complete_async_polls( struct sock *sock, int event, int error )
             req->output[i].flags = req->sockets[i].flags & flags;
             req->output[i].status = sock_get_ntstatus( error );
 
-            async_request_complete( req->async, STATUS_SUCCESS, 0,
-                                    req->count * sizeof(*req->output), req->output );
+            complete_async_poll( req, STATUS_SUCCESS );
             break;
         }
     }
@@ -870,7 +875,7 @@ static void async_poll_timeout( void *private )
 
     if (req->iosb->status != STATUS_PENDING) return;
 
-    async_request_complete( req->async, STATUS_TIMEOUT, 0, req->count * sizeof(*req->output), req->output );
+    complete_async_poll( req, STATUS_TIMEOUT );
 }
 
 static int sock_dispatch_asyncs( struct sock *sock, int event, int error )
@@ -1320,12 +1325,7 @@ static int sock_close_handle( struct object *obj, struct process *process, obj_h
                 }
             }
 
-            if (signaled)
-            {
-                /* pass 0 as result; client will set actual result size */
-                async_request_complete( poll_req->async, STATUS_SUCCESS, 0,
-                                        poll_req->count * sizeof(*poll_req->output), poll_req->output );
-            }
+            if (signaled) complete_async_poll( poll_req, STATUS_SUCCESS );
         }
     }
 
@@ -2913,7 +2913,7 @@ static void poll_socket( struct sock *poll_sock, struct async *async, timeout_t
     }
 
     if (!timeout || signaled)
-        async_request_complete( req->async, STATUS_SUCCESS, 0, count * sizeof(*output), output );
+        complete_async_poll( req, STATUS_SUCCESS );
 
     for (i = 0; i < req->count; ++i)
         sock_reselect( req->sockets[i].sock );




More information about the wine-cvs mailing list