diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2020-09-01 15:09:10 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2020-09-02 13:52:41 +0200 |
| commit | 0bddeb9cf8139eb0ed7a32c86fc25fe460feb0e4 (patch) | |
| tree | dd82a653c5dcd11d8c4e5289652ee25d5c1cdd05 /ios | |
| parent | af89441ee4fbc8422c221246cab658fcff85cf1e (diff) | |
| download | mullvadvpn-0bddeb9cf8139eb0ed7a32c86fc25fe460feb0e4.tar.xz mullvadvpn-0bddeb9cf8139eb0ed7a32c86fc25fe460feb0e4.zip | |
Always call the completion handler
Diffstat (limited to 'ios')
| -rw-r--r-- | ios/MullvadVPN/AutomaticKeyRotationManager.swift | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ios/MullvadVPN/AutomaticKeyRotationManager.swift b/ios/MullvadVPN/AutomaticKeyRotationManager.swift index 27d480c57c..a6c7466ba8 100644 --- a/ios/MullvadVPN/AutomaticKeyRotationManager.swift +++ b/ios/MullvadVPN/AutomaticKeyRotationManager.swift @@ -93,12 +93,12 @@ class AutomaticKeyRotationManager { func startAutomaticRotation(queue: DispatchQueue?, completionHandler: @escaping () -> Void) { dispatchQueue.async { - guard !self.isAutomaticRotationEnabled else { return } + if !self.isAutomaticRotationEnabled { + self.logger.info("Start automatic key rotation") - self.logger.info("Start automatic key rotation") - - self.isAutomaticRotationEnabled = true - self.performKeyRotation() + self.isAutomaticRotationEnabled = true + self.performKeyRotation() + } queue.performOnWrappedOrCurrentQueue(block: completionHandler) } @@ -106,16 +106,16 @@ class AutomaticKeyRotationManager { func stopAutomaticRotation(queue: DispatchQueue?, completionHandler: @escaping () -> Void) { dispatchQueue.async { - guard self.isAutomaticRotationEnabled else { return } - - self.logger.info("Stop automatic key rotation") + if self.isAutomaticRotationEnabled { + self.logger.info("Stop automatic key rotation") - self.isAutomaticRotationEnabled = false + self.isAutomaticRotationEnabled = false - self.dataTask?.cancel() - self.dataTask = nil + self.dataTask?.cancel() + self.dataTask = nil - self.timerSource?.cancel() + self.timerSource?.cancel() + } queue.performOnWrappedOrCurrentQueue(block: completionHandler) } |
