[PATCH] ws2_32/sock: WSARecv/WSASend checks async pendings of the socket.
dongwan_kim at tmax.co.kr
dongwan_kim at tmax.co.kr
Wed Apr 28 21:21:38 CDT 2021
Hi, My name is Dongwan Kim.
I found the misbehavior of WSARecv/WSASend when they are called multiple
times for overlapped I/O to the same socket .
Specifically, the problem occurs if WSARecv is called when overlapped
I/O gets ready. WSARecv intercepts the message from the socket.
for example,
Alice Bob
WSARecv( SOCKET_A, buffer1 ) ; <----- X
... <----- Y
WSARecv(SOCKET_A, buffer2) ;
Bob sent messages( X , Y ) to Alice. Alice should get X to buffer1, Y to
buffer 2 respectively.
But, In the current version of wine , Alice could get Y to buffer 1
because WSARecv always tries to get message from the socket without
checking if there are waiting syncs.
I attached my solution and the programs for testing.
The test server program receives messages from client with WSARecv. you
can run it as : test_server.exe 9088
9088 is port number which is hard-coded in test client program...
The test client program sends fragments of a file to server. you can run
it as : test_client.exe localhost [file_to_send]
I tested with a 96MB file.
The programs are not clean...
If you need, I can send the source code.
Thanks.
Best Regards.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ws2_32-sock-WSARecv-WSASend-checks-async-pendings-of.patch
Type: text/x-diff
Size: 5217 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210429/0e460606/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_client.exe
Type: application/x-dosexec
Size: 10752 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210429/0e460606/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_server.exe
Type: application/x-dosexec
Size: 10752 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210429/0e460606/attachment-0003.bin>
More information about the wine-devel
mailing list