diff options
| author | Emīls Piņķis <emils@mullvad.net> | 2022-09-22 10:28:56 +0200 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2022-09-22 13:14:08 +0200 |
| commit | dd47a4da88ae084eae625f839da61de148844c99 (patch) | |
| tree | ba7cf7237dcb548985a8355b9b4a4f8c21b276fe | |
| parent | 31d88f68d5fd226e5634fcf3a0ceaa08a4dcf244 (diff) | |
| download | mullvadvpn-dd47a4da88ae084eae625f839da61de148844c99.tar.xz mullvadvpn-dd47a4da88ae084eae625f839da61de148844c99.zip | |
Remove shutdown daemon command
| -rw-r--r-- | mullvad-daemon/src/lib.rs | 15 | ||||
| -rw-r--r-- | mullvad-jni/src/daemon_interface.rs | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs index 7a1a2e75da..487c5b1f49 100644 --- a/mullvad-daemon/src/lib.rs +++ b/mullvad-daemon/src/lib.rs @@ -283,9 +283,6 @@ pub enum DaemonCommand { CheckVolumes(ResponseTx<(), Error>), /// Register settings for WireGuard obfuscator SetObfuscationSettings(ResponseTx<(), settings::Error>, ObfuscationSettings), - /// Makes the daemon exit the main loop and quit. - #[cfg(target_os = "android")] - Shutdown, /// Saves the target tunnel state and enters a blocking state. The state is restored /// upon restart. PrepareRestart, @@ -432,6 +429,16 @@ impl DaemonCommandSender { .unbounded_send(InternalDaemonEvent::Command(command)) .map_err(|_| Error::DaemonUnavailable) } + + /// Shuts down the daemon. This triggers the shutdown as though the user would shut it down + /// because blocking traffic on Android relies on the daemon process being alive and keeping a + /// tunnel device open. + #[cfg(target_os = "android")] + pub fn shutdown(&self) -> Result<(), Error> { + self.0 + .unbounded_send(InternalDaemonEvent::TriggerShutdown(true)) + .map_err(|_| Error::DaemonUnavailable) + } } pub(crate) struct DaemonEventSender<E = InternalDaemonEvent> { @@ -1033,8 +1040,6 @@ where SetObfuscationSettings(tx, settings) => { self.on_set_obfuscation_settings(tx, settings).await } - #[cfg(target_os = "android")] - Shutdown => self.trigger_shutdown_event(false), PrepareRestart => self.on_prepare_restart(), #[cfg(target_os = "android")] BypassSocket(fd, tx) => self.on_bypass_socket(fd, tx), diff --git a/mullvad-jni/src/daemon_interface.rs b/mullvad-jni/src/daemon_interface.rs index d23e7b8be4..a9406a5507 100644 --- a/mullvad-jni/src/daemon_interface.rs +++ b/mullvad-jni/src/daemon_interface.rs @@ -293,7 +293,7 @@ impl DaemonInterface { } pub fn shutdown(&self) -> Result<()> { - self.send_command(DaemonCommand::Shutdown) + self.command_sender.shutdown().map_err(Error::NoDaemon) } pub fn submit_voucher(&self, voucher: String) -> Result<VoucherSubmission> { |
