Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move pick_random_relay_excluding to helpers module for consistency #6873

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

faern
Copy link
Member

@faern faern commented Sep 26, 2024

All other helper methods for selecting random relays are there. So I thought it would be easier to read if we have them all in one place. Renaming the function to align more consistently with the others at the same time.

I also added tiny amount of docs. And "fixed" a lifetime nitpick.


This change is Reviewable

@faern faern requested a review from hulthe September 26, 2024 10:01
Copy link
Member Author

@faern faern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 files reviewed, all discussions resolved


mullvad-relay-selector/src/relay_selector/helpers.rs line 35 at r1 (raw file):

pub fn pick_random_relay_excluding<'a>(
    relays: &'a [Relay],
    exclude: &'_ Relay,

Nit, FYI: The relay used for exclusion is not part of the return value. So the exclude reference only has to be valid for the lifetime of this function, not for as long as the return value is alive.

All other helper methods for selecting random relays are there
@faern faern force-pushed the small-smart-routing-code-cleanup branch from cf0278b to f33c557 Compare September 27, 2024 08:18
@faern faern merged commit 980c837 into main Sep 27, 2024
48 of 51 checks passed
@faern faern deleted the small-smart-routing-code-cleanup branch September 27, 2024 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants