TunnelsManager: Fix race between multiple startActivation() calls

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>
This commit is contained in:
Roopesh Chander 2018-12-13 23:34:00 +05:30
parent f9239dae75
commit 3bddab8a9e
1 changed files with 2 additions and 0 deletions

View 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.