diff options
| author | Emīls <emils@mullvad.net> | 2021-03-08 12:16:55 +0000 |
|---|---|---|
| committer | Emīls <emils@mullvad.net> | 2021-03-08 14:28:53 +0000 |
| commit | fe52d414f9ce8dc2adf56b62db503d73992159d9 (patch) | |
| tree | bda2060642e4d33b78e66cbcf834bb54723ad216 | |
| parent | 97df1abc352a10470f147c70925767f53fecba5a (diff) | |
| download | mullvadvpn-fe52d414f9ce8dc2adf56b62db503d73992159d9.tar.xz mullvadvpn-fe52d414f9ce8dc2adf56b62db503d73992159d9.zip | |
Lower account history from 3 to 1
| -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)); |
