Alexandre Julliard : ws2_32: Add a separate structure for async shutdowns.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 3 09:42:10 CST 2015


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Mar  3 15:30:13 2015 +0900

ws2_32: Add a separate structure for async shutdowns.

Conflicts:
	dlls/ws2_32/socket.c

---

 dlls/ws2_32/socket.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 55f4865..01e9869 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -335,11 +335,18 @@ struct ws2_async_io
     struct ws2_async_io *next;
 };
 
+struct ws2_async_shutdown
+{
+    struct ws2_async_io io;
+    HANDLE              hSocket;
+    IO_STATUS_BLOCK     iosb;
+    int                 type;
+};
+
 struct ws2_async
 {
     struct ws2_async_io                 io;
     HANDLE                              hSocket;
-    int                                 type;
     LPWSAOVERLAPPED                     user_overlapped;
     LPWSAOVERLAPPED_COMPLETION_ROUTINE  completion_func;
     IO_STATUS_BLOCK                     local_iosb;
@@ -2266,7 +2273,7 @@ static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS statu
  */
 static NTSTATUS WS2_async_shutdown( void* user, PIO_STATUS_BLOCK iosb, NTSTATUS status, void **apc )
 {
-    struct ws2_async *wsa = user;
+    struct ws2_async_shutdown *wsa = user;
     int fd, err = 1;
 
     switch (status)
@@ -2297,25 +2304,24 @@ static NTSTATUS WS2_async_shutdown( void* user, PIO_STATUS_BLOCK iosb, NTSTATUS
  */
 static int WS2_register_async_shutdown( SOCKET s, int type )
 {
-    struct ws2_async *wsa;
+    struct ws2_async_shutdown *wsa;
     NTSTATUS status;
 
     TRACE("s %04lx type %d\n", s, type);
 
-    wsa = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( struct ws2_async, iovec[1] ));
+    wsa = HeapAlloc( GetProcessHeap(), 0, sizeof(*wsa) );
     if ( !wsa )
         return WSAEFAULT;
 
-    wsa->hSocket         = SOCKET2HANDLE(s);
-    wsa->type            = type;
-    wsa->completion_func = NULL;
+    wsa->hSocket = SOCKET2HANDLE(s);
+    wsa->type    = type;
 
     SERVER_START_REQ( register_async )
     {
         req->type   = type;
         req->async.handle   = wine_server_obj_handle( wsa->hSocket );
         req->async.callback = wine_server_client_ptr( WS2_async_shutdown );
-        req->async.iosb     = wine_server_client_ptr( &wsa->local_iosb );
+        req->async.iosb     = wine_server_client_ptr( &wsa->iosb );
         req->async.arg      = wine_server_client_ptr( wsa );
         req->async.cvalue   = 0;
         status = wine_server_call( req );




More information about the wine-cvs mailing list