summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--mullvad-daemon/src/main.rs3
-rw-r--r--mullvad-daemon/src/relays.rs11
3 files changed, 13 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 32332e8524..37a0a438db 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -41,6 +41,7 @@ Line wrap the file at 100 chars. Th
`mullvad relay list locations`.
- Replace WebSockets with Unix domain sockets/Named pipes for IPC. The location
of the socket can be controlled with `MULLVAD_RPC_SOCKET_PATH`.
+- Update the relay list if it's out of date when the daemon starts.
### Fixed
- Fix incorrect window position when using external display.
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index f5672ff225..12fe4bacb3 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -243,6 +243,9 @@ impl Daemon {
let management_interface_broadcaster =
Self::start_management_interface(tx.clone(), cache_dir.clone())?;
+ // Attempt to download a fresh relay list
+ relay_selector.update();
+
Ok(Daemon {
tunnel_command_tx: Sink::wait(tunnel_command_tx),
tunnel_state: TunnelStateTransition::Disconnected,
diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs
index 4b0b07217e..86d4efbc51 100644
--- a/mullvad-daemon/src/relays.rs
+++ b/mullvad-daemon/src/relays.rs
@@ -122,7 +122,7 @@ impl ParsedRelays {
pub struct RelaySelector {
parsed_relays: Arc<Mutex<ParsedRelays>>,
rng: ThreadRng,
- _updater: RelayListUpdaterHandle,
+ updater: RelayListUpdaterHandle,
}
impl RelaySelector {
@@ -148,10 +148,17 @@ impl RelaySelector {
RelaySelector {
parsed_relays,
rng: rand::thread_rng(),
- _updater: updater,
+ updater,
}
}
+ /// Download the newest relay list.
+ pub fn update(&self) {
+ self.updater
+ .send(())
+ .expect("Relay list updated thread has stopped unexpectedly");
+ }
+
/// Returns all countries and cities. The cities in the object returned does not have any
/// relays in them.
pub fn get_locations(&mut self) -> RelayList {