Skip to content

Fix propagation of "is shutdown user-initiated?" status#10291

Open
MarkusPettersson98 wants to merge 2 commits intomainfrom
fix-user-init-shutdown-propagation-linux-macos
Open

Fix propagation of "is shutdown user-initiated?" status#10291
MarkusPettersson98 wants to merge 2 commits intomainfrom
fix-user-init-shutdown-propagation-linux-macos

Conversation

@MarkusPettersson98
Copy link
Copy Markdown
Contributor

@MarkusPettersson98 MarkusPettersson98 commented Apr 24, 2026

This change is Reviewable

@MarkusPettersson98 MarkusPettersson98 force-pushed the fix-user-init-shutdown-propagation-linux-macos branch 2 times, most recently from 2c93d37 to a0e272b Compare April 24, 2026 14:39
@MarkusPettersson98 MarkusPettersson98 force-pushed the fix-user-init-shutdown-propagation-linux-macos branch from a0e272b to 4fbc350 Compare April 24, 2026 14:40
@MarkusPettersson98 MarkusPettersson98 marked this pull request as ready for review April 24, 2026 14:40
Copy link
Copy Markdown
Contributor

@hulthe hulthe left a comment

Choose a reason for hiding this comment

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

@hulthe reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on hulthe).


mullvad-daemon/src/shutdown.rs line 50 at r1 (raw file):

#[cfg(target_os = "macos")]
pub fn is_shutdown_user_initiated() -> bool {
    false

TODO:

Copy link
Copy Markdown
Contributor

@hulthe hulthe left a comment

Choose a reason for hiding this comment

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

@hulthe made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on MarkusPettersson98).


mullvad-daemon/src/main.rs line 207 at r3 (raw file):

    #[cfg(any(target_os = "linux", target_os = "macos"))]
    mullvad_daemon::shutdown::set_shutdown_signal_handler(move || {
        shutdown_handle.shutdown(!mullvad_daemon::shutdown::is_shutdown_user_initiated())

Did some testing and some thinking.

Since we're removing two ! operators on linux, the behavior will stay the same, except in the error case, i.e. where the user isn't running systemd.

On macOS, we currently remove a single !, inverting the behavior. This means the daemon will always block if it's stopped. On main, it never blocks when daemon is shut down, meaning that macOS network traffic can leak on reboot.

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