From 9bd251fe797a75d7dd69f6e52b000dc3e90b63ec Mon Sep 17 00:00:00 2001 From: Jeroen Leenarts Date: Sun, 2 Sep 2018 23:23:30 +0200 Subject: [PATCH] Lazy WGContext made connection unstable. Signed-off-by: Jason A. Donenfeld --- WireGuardNetworkExtension/PacketTunnelProvider.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/WireGuardNetworkExtension/PacketTunnelProvider.swift b/WireGuardNetworkExtension/PacketTunnelProvider.swift index ba440d0..ce37c8a 100644 --- a/WireGuardNetworkExtension/PacketTunnelProvider.swift +++ b/WireGuardNetworkExtension/PacketTunnelProvider.swift @@ -19,9 +19,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider { // MARK: Properties var wgHandle: Int32? - lazy var wgContext: WireGuardContext? = { - return WireGuardContext(packetFlow: self.packetFlow) - }() + var wgContext: WireGuardContext? // MARK: NEPacketTunnelProvider @@ -42,6 +40,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider { } configureLogger() + wgContext = WireGuardContext(packetFlow: self.packetFlow) let handle = connect(interfaceName: interfaceName, settings: settings)