Fix Windows device asynchronous write behavior.
authorEtienne Dechamps <etienne@edechamps.fr>
Sat, 14 Mar 2015 18:19:22 +0000 (18:19 +0000)
committerEtienne Dechamps <etienne@edechamps.fr>
Sun, 15 Mar 2015 10:34:40 +0000 (10:34 +0000)
Write operations to the Windows device do not necessarily complete
immediately; in fact, with the latest TAP-Win32 drivers, this never
seems to be the case.

write_packet() does not handle that case correctly, because the
OVERLAPPED structure and the packet data go out of scope before the
write operation completes, resulting in race conditions.

This commit fixes the issue by making sure these data structures are
kept in global scope, and by dropping any packets that may arrive while
the previous write operation is still pending.


No differences found