summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2019-09-11 15:48:56 +0200
committerLinus Färnstrand <linus@mullvad.net>2019-09-13 11:29:04 +0200
commit795132adb6f8e7219782e90de0a22c33c0abe012 (patch)
treeaa03cd031791b93c753728367d30242d657f43a3
parentfdd1fb09a5e0ca6d1e3275d2be1e773630219d81 (diff)
downloadmullvadvpn-795132adb6f8e7219782e90de0a22c33c0abe012.tar.xz
mullvadvpn-795132adb6f8e7219782e90de0a22c33c0abe012.zip
Only consider active relays in relay selection algorithm
-rw-r--r--mullvad-daemon/src/relays.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/mullvad-daemon/src/relays.rs b/mullvad-daemon/src/relays.rs
index a046535b30..65590f5fc8 100644
--- a/mullvad-daemon/src/relays.rs
+++ b/mullvad-daemon/src/relays.rs
@@ -321,6 +321,7 @@ impl RelaySelector {
.lock()
.relays()
.iter()
+ .filter(|relay| relay.active)
.filter_map(|relay| Self::matching_bridge_relay(relay, constraints))
.collect();
@@ -349,6 +350,7 @@ impl RelaySelector {
.lock()
.relays()
.iter()
+ .filter(|relay| relay.active)
.filter_map(|relay| Self::matching_relay(relay, constraints))
.collect();
@@ -495,6 +497,7 @@ impl RelaySelector {
.cloned()
.collect()
}
+
/// Pick a random relay from the given slice. Will return `None` if the given slice is empty
/// or all relays in it has zero weight.
fn pick_random_relay<'a>(&mut self, relays: &'a [Relay]) -> Option<&'a Relay> {