diff options
| author | David Lönnhager <david.l@mullvad.net> | 2020-11-10 14:42:15 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2020-11-19 01:35:22 +0100 |
| commit | fe9be13deced09e6715b05da2e2cd27921c263af (patch) | |
| tree | 1836d7efbae555aca35c613fa384a2194bbe0591 /mullvad-setup | |
| parent | 461dd7f6fd4909e598dfd190f846d1fcc68d6f6b (diff) | |
| download | mullvadvpn-fe9be13deced09e6715b05da2e2cd27921c263af.tar.xz mullvadvpn-fe9be13deced09e6715b05da2e2cd27921c263af.zip | |
Shuffle API address cache when loaded, and use bundled API address cache as fallback
Diffstat (limited to 'mullvad-setup')
| -rw-r--r-- | mullvad-setup/src/main.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/mullvad-setup/src/main.rs b/mullvad-setup/src/main.rs index 0e0776fe92..396b86fa2b 100644 --- a/mullvad-setup/src/main.rs +++ b/mullvad-setup/src/main.rs @@ -109,12 +109,15 @@ async fn reset_firewall() -> Result<(), Error> { } async fn clear_history() -> Result<(), Error> { - let (cache_path, settings_path) = get_paths()?; + let (cache_path, resource_path, settings_path) = get_paths()?; - let mut rpc_runtime = - MullvadRpcRuntime::with_cache_dir(tokio::runtime::Handle::current(), &cache_path) - .await - .map_err(Error::RpcInitializationError)?; + let mut rpc_runtime = MullvadRpcRuntime::with_cache( + tokio::runtime::Handle::current(), + &resource_path, + Some(&cache_path), + ) + .await + .map_err(Error::RpcInitializationError)?; let mut account_history = account_history::AccountHistory::new( &cache_path, @@ -131,18 +134,20 @@ async fn clear_history() -> Result<(), Error> { } #[cfg(not(windows))] -fn get_paths() -> Result<(PathBuf, PathBuf), Error> { +fn get_paths() -> Result<(PathBuf, PathBuf, PathBuf), Error> { let cache_path = mullvad_paths::cache_dir().map_err(Error::CachePathError)?; + let resource_path = mullvad_paths::get_resource_dir(); let settings_path = mullvad_paths::settings_dir().map_err(Error::SettingsPathError)?; - Ok((cache_path, settings_path)) + Ok((cache_path, resource_path, settings_path)) } #[cfg(windows)] -fn get_paths() -> Result<(PathBuf, PathBuf), Error> { +fn get_paths() -> Result<(PathBuf, PathBuf, PathBuf), Error> { let settings_path = daemon_paths::get_mullvad_daemon_settings_path().map_err(Error::CachePathError)?; + let resource_path = mullvad_paths::get_resource_dir(); let cache_path = daemon_paths::get_mullvad_daemon_cache_path().map_err(Error::SettingsPathError)?; - Ok((cache_path, settings_path)) + Ok((cache_path, resource_path, settings_path)) } |
