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

Fix feature indicators missing during connecting state #6643

Merged

Conversation

Serock3
Copy link
Contributor

@Serock3 Serock3 commented Aug 19, 2024

Feature indicators were missing during the connecting state. This was
because they were calculated using the endpoint of the previous tunnel
state.

This commit fixes the bug and restructures the access to feature
indicators to be more readable.

Fixes DES-1140


This change is Reviewable

Copy link

linear bot commented Aug 19, 2024

@Serock3 Serock3 requested a review from dlon August 19, 2024 13:48
Copy link
Member

@dlon dlon left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Serock3)


mullvad-daemon/src/lib.rs line 1136 at r1 (raw file):

        // state (e.g. activating lockdown mode). Note that only the connected and connecting states
        // have feature indicators.
        match &mut self.tunnel_state {

What do you think of adding a getter in TunnelState that returns a mutable optional reference to feature_indicators?


mullvad-daemon/src/lib.rs line 2837 at r1 (raw file):

    fn on_get_feature_indicators(&self, tx: oneshot::Sender<FeatureIndicators>) {
        let feature_indicators = match &self.tunnel_state {

What do you think of keeping the getter (TunnelState::get_feature_indicators) and just calling unwrap_or_default() on that?

Copy link
Contributor Author

@Serock3 Serock3 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: all files reviewed, 1 unresolved discussion (waiting on @dlon)


mullvad-daemon/src/lib.rs line 1136 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

What do you think of adding a getter in TunnelState that returns a mutable optional reference to feature_indicators?

I am not strongly against the idea of keeping the getter. In this case I also needed the endpoint so it was simpler with just a match statement, so I prefer to keep it this way here.


mullvad-daemon/src/lib.rs line 2837 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

What do you think of keeping the getter (TunnelState::get_feature_indicators) and just calling unwrap_or_default() on that?

Here, keeping the getter would be a little simpler, or at least it would hide away the logic. It would be the only place where it is used though, so I am stil not convinced. Also, the fact that feature indicators only exist in the connected and connecting states is more readable this way.

Feature indicators were missing during the connecting state. This was
because they were calculated using the endpoint of the previous tunnel
state.

This commit fixes the bug and restructures the access to feature
indicators to be more readable.
@dlon dlon force-pushed the fix-feature-indicators-missing-during-connecting-state-des-1140 branch from 0ecb703 to 3129746 Compare August 20, 2024 09:38
@dlon dlon merged commit fc4facc into main Aug 20, 2024
50 of 51 checks passed
@dlon dlon deleted the fix-feature-indicators-missing-during-connecting-state-des-1140 branch August 20, 2024 10:01
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