]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
TunnelsManager: Fix race between multiple startActivation() calls
authorRoopesh Chander <roop@roopc.net>
Thu, 13 Dec 2018 18:04:00 +0000 (23:34 +0530)
committerRoopesh Chander <roop@roopc.net>
Thu, 13 Dec 2018 18:04:00 +0000 (23:34 +0530)
After startActivate() is called on a waiting tunnel, user might turn
on a different tunnel before the waiting tunnel's status gets updated.
This fix prevents that from happening.

Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/WireGuard/Tunnel/TunnelsManager.swift

index 8f53ef9a5621ec500c3a690074da3aa6116af621..25d894b08ed7202b7fc6ee8f98888d82baddfc6c 100644 (file)
@@ -392,6 +392,8 @@ class TunnelContainer: NSObject {
 
         wg_log(.debug, message: "startActivation: Entering (tunnel: \(self.name))")
 
+        self.status = .activating // Ensure that no other tunnel can attempt activation until this tunnel is done trying
+
         guard tunnelProvider.isEnabled else {
             // In case the tunnel had gotten disabled, re-enable and save it,
             // then call this function again.