NetworkExtension: close context before turning off go
The go turnOff code waits for all readers to have completed. In order to make readers complete, we must send the signal to unblock the request. Thus, we must reorder these. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
1 parent
3ed88cd858
commit
d2f3a29f45
1 file changed
+1
-1
@@ -125,10 +125,10 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
|
|||||||
/// Begin the process of stopping the tunnel.
|
/// Begin the process of stopping the tunnel.
|
||||||
override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
|
override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
|
||||||
os_log("Stopping tunnel", log: OSLog.default, type: .info)
|
os_log("Stopping tunnel", log: OSLog.default, type: .info)
|
||||||
|
wgContext?.closeTunnel()
|
||||||
if let handle = wgHandle {
|
if let handle = wgHandle {
|
||||||
wgTurnOff(handle)
|
wgTurnOff(handle)
|
||||||
}
|
}
|
||||||
wgContext?.closeTunnel()
|
|
||||||
completionHandler()
|
completionHandler()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user