Update usage of Wintun, avoid disconnections on Windows
Fixes #338 (closed)
Start by following the example in Wintun 10.2 and 0.13 to the letter:
- Always call
WintunReleaseReceivePacket()
afterWintunReceivePacket()
, even if the packet is dropped due to exceeding the tunnel MTU. - Extended logging with
GetLastError()
. - Clean up adapters as in the Wintun example:
https://github.com/WireGuard/wintun/blob/73a4cffee083e3fdfa4143590d01e51e0f63c9f0/example/example.c#L392-L394cleanupAdapter: WintunDeleteAdapter(Adapter, FALSE, NULL); WintunFreeAdapter(Adapter);
Then fix the actual errors in our code.
Edited by Dimitri Papadopoulos Orfanos