Lazy WGContext made connection unstable.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jeroen Leenarts 2018-09-02 23:23:30 +02:00
parent 8766750bb8
commit 9bd251fe79
1 changed files with 2 additions and 3 deletions

View File

@ -19,9 +19,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
// MARK: Properties // MARK: Properties
var wgHandle: Int32? var wgHandle: Int32?
lazy var wgContext: WireGuardContext? = { var wgContext: WireGuardContext?
return WireGuardContext(packetFlow: self.packetFlow)
}()
// MARK: NEPacketTunnelProvider // MARK: NEPacketTunnelProvider
@ -42,6 +40,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
} }
configureLogger() configureLogger()
wgContext = WireGuardContext(packetFlow: self.packetFlow)
let handle = connect(interfaceName: interfaceName, settings: settings) let handle = connect(interfaceName: interfaceName, settings: settings)