diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2019-09-11 15:48:56 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2019-09-13 11:29:04 +0200 |
| commit | 795132adb6f8e7219782e90de0a22c33c0abe012 (patch) | |
| tree | aa03cd031791b93c753728367d30242d657f43a3 | |
| parent | fdd1fb09a5e0ca6d1e3275d2be1e773630219d81 (diff) | |
| download | mullvadvpn-795132adb6f8e7219782e90de0a22c33c0abe012.tar.xz mullvadvpn-795132adb6f8e7219782e90de0a22c33c0abe012.zip | |
Only consider active relays in relay selection algorithm
| -rw-r--r-- | mullvad-daemon/src/relays.rs | 3 |
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> { |
