wintun driver get stalled for few sec until another packet is being sent -- approach 1
cover wintun driver get stalled for few sec until another packet is being sent -- approach 1
## changes:
- I observed a code [which can lead to a stall condition in the wintun driver](https://github.com/Twingate/wintun/blob/6bfc34a60aa944149fdc7e9cddb191e9a8b6ec1a/driver/twintun.c#L487-L488)
- I didn't want to change the driver code as, I was not sure if it will create a busy loop on kernel
- so instead I tackle this on the client-part of wintun
# issue description: ## Reproducing issue - run iperf client on Client machine with the command `iperf3 -c 127.0.0.1.us.east.direct.vpn -t 300 -b0 -P1` - once in a while we see intervals when no throughput goes to 0 and it takes about 4-5 sec to get out of this situation.
odedkatz (1):
remove the condition on possibly stale variable
(Session->Descriptor.Receive.Ring->Alertable) for Setting
TailMoved eventapi/session.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/1 remove the condition on possibly stale variable (Session->Descriptor.Receive.Ring->Alertable) for Setting TailMoved event
otherwise wintun driver just holds on the event until something wakes it up (see here)[https://github.com/Twingate/wintun/blob/6bfc34a60aa944149fdc7e9cddb191e9a8b6ec1a/driver/twintun.c#L487-L488]
--- api/session.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
api/session.c +1 -2
@@ -302,8 +302,7 @@ WintunSendPacket(TUN_SESSION *Session, const BYTE *Packet)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); +SetEvent (Session->Descriptor.Receive.TailMoved); }LeaveCriticalSection (&Session->Receive.Lock); }
Signature · 1 line
2.43.0