diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | mullvad-daemon/src/account_history.rs | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 70bad09ff5..5aeb8a66e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Line wrap the file at 100 chars. Th - Allow provider constraint to specify multiple hosting providers. - Only download a new relay list if it has been modified. - Connect to the API only via TLS 1.3 +- Shrink account history capactity from 3 account entries to 1. #### Android - WireGuard key is now rotated sooner: every four days instead of seven. diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs index 8853f58550..31e7feac26 100644 --- a/mullvad-daemon/src/account_history.rs +++ b/mullvad-daemon/src/account_history.rs @@ -29,7 +29,7 @@ pub enum Error { } static ACCOUNT_HISTORY_FILE: &str = "account-history.json"; -static ACCOUNT_HISTORY_LIMIT: usize = 3; +static ACCOUNT_HISTORY_LIMIT: usize = 1; /// A trivial MRU cache of account data pub struct AccountHistory { @@ -186,7 +186,7 @@ impl AccountHistory { accounts.retain(|entry| entry.account != new_entry.account); accounts.push_front(new_entry); - if accounts.len() > ACCOUNT_HISTORY_LIMIT { + while accounts.len() > ACCOUNT_HISTORY_LIMIT { let last_entry = accounts.pop_back().unwrap(); if let Some(wg_data) = last_entry.wireguard { tokio::spawn(self.create_remove_wg_key_rpc(&last_entry.account, &wg_data)); |
