ws2_32: only enable FD_WRITE on short sends

Damjan Jovanovic damjan.jov at
Sun Sep 7 05:41:19 CDT 2008

* only enable FD_WRITE on short sends

I sent a patch a long time ago to make FD_WRITE enabled after every
send(), which seemed to fix bug 7685, but also caused bug 9777. A more
detailed analysis of the code in bug 7685 reveals that emule's
WebSocket.cpp expects a FD_WRITE event not only after send()=-1 &&
WSAEWOULDBLOCK, but also after every send() that sends less data than
requested. It's the short send() that needs to enable FD_WRITE, rather
than every send(). Patch tested with 7685 -> works.

This patch also fixes the test_write_events() test, which never passed
on Windows.

In addition, thorough testing on Windows 2000 and Vista reveals very
strange behaviour. Sending through a non-blocking socket to a blocking
socket on the same host seems to block (both sockets have to be
non-blocking for it not to block), and send() is never short even for
non-blocking sockets: you can repeatedly send() 100 MB of data, and it
will either queue them all or fail with WSAEWOULDBLOCK, but never send
less than that. The latter sounds like bad news: Wine does short sends
in that case...

Damjan Jovanovic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fd_write.patch
Type: text/x-diff
Size: 7561 bytes
Desc: not available
Url : 

More information about the wine-patches mailing list