diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2022-02-01 14:08:14 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2022-02-02 17:37:00 +0100 |
| commit | 45fc06dbc4f9f2275fad59c0df14d40cfb1d76ce (patch) | |
| tree | 8cfc6870183927b6a3e593de9f75c118d27872db | |
| parent | 27851cc3d6a7abfa70afe2314df9949655b2cbc1 (diff) | |
| download | mullvadvpn-45fc06dbc4f9f2275fad59c0df14d40cfb1d76ce.tar.xz mullvadvpn-45fc06dbc4f9f2275fad59c0df14d40cfb1d76ce.zip | |
ReplaceKeyOperation: slightly rewrite the key rotation logic
| -rw-r--r-- | ios/MullvadVPN/TunnelManager/ReplaceKeyOperation.swift | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ios/MullvadVPN/TunnelManager/ReplaceKeyOperation.swift b/ios/MullvadVPN/TunnelManager/ReplaceKeyOperation.swift index 6cc9828c57..e99591c217 100644 --- a/ios/MullvadVPN/TunnelManager/ReplaceKeyOperation.swift +++ b/ios/MullvadVPN/TunnelManager/ReplaceKeyOperation.swift @@ -112,9 +112,9 @@ class ReplaceKeyOperation: AsyncOperation { if let rotationInterval = rotationInterval { let creationDate = tunnelInfo.tunnelSettings.interface.privateKey.creationDate - let timeElapsed = Date().timeIntervalSince(creationDate) + let nextRotationDate = creationDate.addingTimeInterval(rotationInterval) - if timeElapsed < rotationInterval { + if nextRotationDate > Date() { logger.debug("Throttle private key rotation.") completionHandler(.success(.throttled(creationDate))) |
