From: Etienne Dechamps Date: Sat, 14 Mar 2015 18:19:22 +0000 (+0000) Subject: Fix Windows device asynchronous write behavior. X-Git-Tag: release-1.1pre12~186^2 X-Git-Url: https://www.tinc-vpn.org/git/browse?a=commitdiff_plain;h=89715454c083aaeb4dc73340f2d0ab9a3d9503e0;hp=89715454c083aaeb4dc73340f2d0ab9a3d9503e0;p=tinc Fix Windows device asynchronous write behavior. 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. ---