Winsock: bugs in asynchronous shutdown()

Martin Wilck Martin.Wilck at Fujitsu-Siemens.com
Wed Dec 4 09:58:59 CST 2002


Modified files:
	dlls/winsock: socket.c

ChangeLog: Martin Wilck <Martin.Wilck at Fujitsu-Siemens.com>
	Correct 2 bugs connected to asynchronous shutdown():
	- Cannot call WSAGetOverlappedResult() because completion
	  function destroys the overlapped structure
	- ws2_async_cleanup() called twice in case of failure.

	Bugs reported by Andreas Mohr <andi at rhlx01.fht-esslingen.de>
	for the eMule application.


Index: socket.c
===================================================================
RCS file: /home/wine/wine/dlls/winsock/socket.c,v
retrieving revision 1.114
diff -u -r1.114 socket.c
--- socket.c	13 Nov 2002 19:42:23 -0000	1.114
+++ socket.c	3 Dec 2002 15:44:42 -0000
@@ -1376,15 +1376,11 @@
     if ( (ret = register_new_async ( &wsa->async )) )
     {
         err = NtStatusToWSAError ( ret );
-        ws2_async_cleanup ( &wsa->async );
         goto out;
     }
     /* Try immediate completion */
-    if ( WSAGetOverlappedResult ( s, ovl, NULL, FALSE, NULL ) )
-        return 0;
-    if ( (err = WSAGetLastError ()) == WSA_IO_INCOMPLETE )
-        return 0;
-    return WSAEINVAL;
+    while ( WaitForSingleObjectEx ( ovl->hEvent, 0, TRUE ) == STATUS_USER_APC );
+    return 0;
 
 out_close:
     WSACloseEvent ( ovl->hEvent );

-- 
Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at Fujitsu-Siemens.com
D-33106 Paderborn           http://www.fujitsu-siemens.com/primergy








More information about the wine-patches mailing list