tap-win32: disable broken async write path
commitb73c1849148da1229a3c3b336311a8194970b35f
authorAndrew Baumann <Andrew.Baumann@microsoft.com>
Wed, 18 Nov 2015 19:45:09 +0000 (18 11:45 -0800)
committerJason Wang <jasowang@redhat.com>
Fri, 27 Nov 2015 02:39:55 +0000 (27 10:39 +0800)
tree2a1fbe4264ff8022814af20a6924eb32beaa7746
parentee0428e3acd237e4d555cc54134cea473cab5ee7
tap-win32: disable broken async write path

The code under the TUN_ASYNCHRONOUS_WRITES path makes two incorrect
assumptions about the behaviour of the WriteFile API for overlapped
file handles. First, WriteFile does not update the
lpNumberOfBytesWritten parameter when the write completes
asynchronously (the number of bytes written is known only when the
operation completes). Second, the buffer shouldn't be touched (or
freed) until the operation completes. This led to at least one bug
where tap_win32_write returned zero bytes written, which in turn
caused further writes ("receives") to be disabled for that device.

This change disables the asynchronous write path, while keeping most
of the code around in case someone sees value in resurrecting it. It
also adds some conditional debug output, similar to the read path.

Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Acked-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/tap-win32.c