aboutsummaryrefslogtreecommitdiff
path: root/tun/tun_windows.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-11-21 14:48:21 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-11-22 13:13:55 +0100
commit2b242f93932e1c4ab8b45dd0f628dd4fe063699b (patch)
tree379f4a2daca264c09f12b6f7fd592243aa05202c /tun/tun_windows.go
parent4cdf805b29b1aaca1fab317ca4fce54c7fd69bf6 (diff)
downloadwireguard-go-2b242f93932e1c4ab8b45dd0f628dd4fe063699b.tar.gz
wireguard-go-2b242f93932e1c4ab8b45dd0f628dd4fe063699b.zip
wintun: manage ring memory manually
It's large and Go's garbage collector doesn't deal with it especially well.
Diffstat (limited to 'tun/tun_windows.go')
-rw-r--r--tun/tun_windows.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go
index daad4aa..8fc5174 100644
--- a/tun/tun_windows.go
+++ b/tun/tun_windows.go
@@ -35,11 +35,11 @@ type NativeTun struct {
wt *wintun.Interface
handle windows.Handle
close bool
- rings wintun.RingDescriptor
events chan Event
errors chan error
forcedMTU int
rate rateJuggler
+ rings *wintun.RingDescriptor
}
const WintunPool = wintun.Pool("WireGuard")
@@ -93,13 +93,13 @@ func CreateTUNWithRequestedGUID(ifname string, requestedGUID *windows.GUID, mtu
forcedMTU: forcedMTU,
}
- err = tun.rings.Init()
+ tun.rings, err = wintun.NewRingDescriptor()
if err != nil {
tun.Close()
return nil, fmt.Errorf("Error creating events: %v", err)
}
- tun.handle, err = tun.wt.Register(&tun.rings)
+ tun.handle, err = tun.wt.Register(tun.rings)
if err != nil {
tun.Close()
return nil, fmt.Errorf("Error registering rings: %v", err)