diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-07-20 09:27:09 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-07-20 09:27:09 +0200 |
| commit | 2ff4b499157c1bca4e76b6ed47068fa35f7030d5 (patch) | |
| tree | e9bc33e470ef95f018d01dce24e0a22201c947b2 | |
| parent | 18899e14d176c5fc8ad8296a7cc9daa88e90c854 (diff) | |
| parent | b63de0af0ec471e4d00401f574259461e62c6cab (diff) | |
| download | mullvadvpn-2ff4b499157c1bca4e76b6ed47068fa35f7030d5.tar.xz mullvadvpn-2ff4b499157c1bca4e76b6ed47068fa35f7030d5.zip | |
Merge branch 'fix-dev-version-check-errors'
| -rw-r--r-- | mullvad-daemon/src/version_check.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/mullvad-daemon/src/version_check.rs b/mullvad-daemon/src/version_check.rs index 10dbf7bfb4..6e1a9bc568 100644 --- a/mullvad-daemon/src/version_check.rs +++ b/mullvad-daemon/src/version_check.rs @@ -343,7 +343,12 @@ impl VersionUpdater { // If this is a dev build, there's no need to pester the API for version checks. if *IS_DEV_BUILD { log::warn!("Not checking for updates because this is a development build"); - while rx.next().await.is_some() {} + while let Some(cmd) = rx.next().await { + if let VersionUpdaterCommand::RunVersionCheck(done_tx) = cmd { + log::info!("Version check is disabled in dev builds"); + let _ = done_tx.send(dev_version_cache()); + } + } return; } @@ -423,6 +428,10 @@ impl VersionUpdater { } async fn try_load_cache(cache_dir: &Path) -> Result<AppVersionInfo, Error> { + if *IS_DEV_BUILD { + return Ok(dev_version_cache()); + } + let path = cache_dir.join(VERSION_INFO_FILENAME); log::debug!("Loading version check cache from {}", path.display()); let content = fs::read_to_string(&path) @@ -451,6 +460,17 @@ pub async fn load_cache(cache_dir: &Path) -> Option<AppVersionInfo> { } } +fn dev_version_cache() -> AppVersionInfo { + assert!(*IS_DEV_BUILD); + + AppVersionInfo { + supported: false, + latest_stable: PRODUCT_VERSION.to_owned(), + latest_beta: PRODUCT_VERSION.to_owned(), + suggested_upgrade: None, + } +} + #[cfg(test)] mod test { use super::*; |
