summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2020-09-01 14:17:11 +0200
committerAndrej Mihajlov <and@mullvad.net>2020-09-02 13:52:41 +0200
commitaf89441ee4fbc8422c221246cab658fcff85cf1e (patch)
tree133b5acad9b89ffb5371aa7785fa340f40f95170 /ios
parentd7ef88960e343bd0cf49dc0fcbbe6ab4fc40aea9 (diff)
downloadmullvadvpn-af89441ee4fbc8422c221246cab658fcff85cf1e.tar.xz
mullvadvpn-af89441ee4fbc8422c221246cab658fcff85cf1e.zip
Make sure to call the system completionHandler after the stop operation is fully finished
On iOS 13.4 the tunnel process is terminated when the completion handler is called. Postponing the call until we clear out the operation queue lets PacketTunnel deallocate before the process exits
Diffstat (limited to 'ios')
-rw-r--r--ios/PacketTunnel/PacketTunnelProvider.swift6
1 files changed, 4 insertions, 2 deletions
diff --git a/ios/PacketTunnel/PacketTunnelProvider.swift b/ios/PacketTunnel/PacketTunnelProvider.swift
index 3657009909..784e3fc8fe 100644
--- a/ios/PacketTunnel/PacketTunnelProvider.swift
+++ b/ios/PacketTunnel/PacketTunnelProvider.swift
@@ -84,12 +84,14 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
case .failure(let error):
self.logger.error(chainedError: error, message: "Failed to stop the tunnel")
}
-
- completionHandler()
finish()
}
}
+ operation.addDidFinishBlockObserver { (op) in
+ completionHandler()
+ }
+
exclusivityController.addOperation(operation, categories: [.exclusive])
}