example: account for buffer being drained too slowly
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
5d1efa847f
commit
e2ffd0b3b3
@ -247,10 +247,13 @@ SendPackets(_Inout_ DWORD_PTR SessionPtr)
|
|||||||
while (!HaveQuit)
|
while (!HaveQuit)
|
||||||
{
|
{
|
||||||
BYTE *Packet = WintunAllocateSendPacket(Session, 28);
|
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");
|
return LogLastError(L"Packet write failed");
|
||||||
MakeICMP(Packet);
|
|
||||||
WintunSendPacket(Session, Packet);
|
|
||||||
|
|
||||||
switch (WaitForSingleObject(QuitEvent, 1000 /* 1 second */))
|
switch (WaitForSingleObject(QuitEvent, 1000 /* 1 second */))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user