diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2020-07-08 21:22:33 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2020-07-15 14:33:00 +0200 |
| commit | a5ff0e8a5b3dbbff1d8d30363c2a2d3c657337f2 (patch) | |
| tree | 8aedd95e9e11063db3b92aa86acecec3649f57d8 | |
| parent | 641c0b95822c55019f758b164c0e0273c17f0f39 (diff) | |
| download | mullvadvpn-a5ff0e8a5b3dbbff1d8d30363c2a2d3c657337f2.tar.xz mullvadvpn-a5ff0e8a5b3dbbff1d8d30363c2a2d3c657337f2.zip | |
Fix possible race condition in timer
| -rw-r--r-- | ios/MullvadVPN/AutomaticKeyRotationManager.swift | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ios/MullvadVPN/AutomaticKeyRotationManager.swift b/ios/MullvadVPN/AutomaticKeyRotationManager.swift index 350ef6aa80..b605b7e3da 100644 --- a/ios/MullvadVPN/AutomaticKeyRotationManager.swift +++ b/ios/MullvadVPN/AutomaticKeyRotationManager.swift @@ -239,7 +239,11 @@ class AutomaticKeyRotationManager { private func scheduleRetry(wallDeadline: DispatchWallTime) { let timerSource = DispatchSource.makeTimerSource(queue: dispatchQueue) timerSource.setEventHandler { [weak self] in - self?.performKeyRotation() + guard let self = self else { return } + + if self.isAutomaticRotationEnabled { + self.performKeyRotation() + } } timerSource.schedule(wallDeadline: wallDeadline) |
