diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-04 14:46:06 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-11-04 14:50:03 +0100 |
commit | e2ffd0b3b3261adb61d7607283a816acdb477dc4 (patch) | |
tree | 884b4b444a618b9c3910a3cb285cbb0f9613c211 | |
parent | api: use a logging alloc function (diff) | |
download | wintun-e2ffd0b3b3261adb61d7607283a816acdb477dc4.tar.xz wintun-e2ffd0b3b3261adb61d7607283a816acdb477dc4.zip |
example: account for buffer being drained too slowly
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | example/example.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/example/example.c b/example/example.c index f6eec93..e7af3b3 100644 --- a/example/example.c +++ b/example/example.c @@ -247,10 +247,13 @@ SendPackets(_Inout_ DWORD_PTR SessionPtr) while (!HaveQuit)
{
BYTE *Packet = WintunAllocateSendPacket(Session, 28);
- if (!Packet)
+ if (Packet)
+ {
+ MakeICMP(Packet);
+ WintunSendPacket(Session, Packet);
+ }
+ else if (GetLastError() != ERROR_BUFFER_OVERFLOW)
return LogLastError(L"Packet write failed");
- MakeICMP(Packet);
- WintunSendPacket(Session, Packet);
switch (WaitForSingleObject(QuitEvent, 1000 /* 1 second */))
{
|