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.
This commit is contained in:
Jason A. Donenfeld 2018-10-31 03:03:00 +01:00
parent 8e98da9e50
commit 47c9924405
1 changed files with 1 additions and 1 deletions

View File

@ -125,10 +125,10 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
/// Begin the process of stopping the tunnel.
override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
os_log("Stopping tunnel", log: OSLog.default, type: .info)
wgContext?.closeTunnel()
if let handle = wgHandle {
wgTurnOff(handle)
}
wgContext?.closeTunnel()
completionHandler()
}