api: skip notifying driver when there are no receive packets yet
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
6af568d1e0
commit
ecf70261da
@ -293,8 +293,10 @@ WintunSendPacket(_In_ TUN_SESSION *Session, _In_ const BYTE *Packet)
|
||||
TUN_RING_WRAP(Session->Receive.TailRelease + AlignedPacketSize, Session->Capacity);
|
||||
Session->Receive.PacketsToRelease--;
|
||||
}
|
||||
WriteULongRelease(&Session->Descriptor.Receive.Ring->Tail, Session->Receive.TailRelease);
|
||||
if (ReadAcquire(&Session->Descriptor.Receive.Ring->Alertable))
|
||||
SetEvent(Session->Descriptor.Receive.TailMoved);
|
||||
if (Session->Descriptor.Receive.Ring->Tail != Session->Receive.TailRelease) {
|
||||
WriteULongRelease(&Session->Descriptor.Receive.Ring->Tail, Session->Receive.TailRelease);
|
||||
if (ReadAcquire(&Session->Descriptor.Receive.Ring->Alertable))
|
||||
SetEvent(Session->Descriptor.Receive.TailMoved);
|
||||
}
|
||||
LeaveCriticalSection(&Session->Receive.Lock);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user