mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
fix(windows): disconnect tunnel on sign-out (#2932)
This commit is contained in:
@@ -220,13 +220,14 @@ fn handle_system_tray_event(app: &tauri::AppHandle, event: TrayMenuEvent) -> Res
|
||||
}
|
||||
TrayMenuEvent::SignIn => app
|
||||
.try_state::<Managed>()
|
||||
.ok_or_else(|| anyhow!("getting ctlr_tx state"))?
|
||||
.ok_or_else(|| anyhow!("couldn't get ctlr_tx state"))?
|
||||
.ctlr_tx
|
||||
.blocking_send(ControllerRequest::SignIn)?,
|
||||
TrayMenuEvent::SignOut => {
|
||||
keyring_entry()?.delete_password()?;
|
||||
app.tray_handle().set_menu(signed_out_menu())?;
|
||||
}
|
||||
TrayMenuEvent::SignOut => app
|
||||
.try_state::<Managed>()
|
||||
.ok_or_else(|| anyhow!("couldn't get ctlr_tx state"))?
|
||||
.ctlr_tx
|
||||
.blocking_send(ControllerRequest::SignOut)?,
|
||||
TrayMenuEvent::Quit => app.exit(0),
|
||||
}
|
||||
Ok(())
|
||||
@@ -237,6 +238,7 @@ pub(crate) enum ControllerRequest {
|
||||
GetAdvancedSettings(oneshot::Sender<AdvancedSettings>),
|
||||
SchemeRequest(url::Url),
|
||||
SignIn,
|
||||
SignOut,
|
||||
UpdateResources(Vec<connlib_client_shared::ResourceDescription>),
|
||||
}
|
||||
|
||||
@@ -464,6 +466,14 @@ async fn run_controller(
|
||||
None,
|
||||
)?;
|
||||
}
|
||||
Req::SignOut => {
|
||||
keyring_entry()?.delete_password()?;
|
||||
if let Some(mut session) = controller.connlib_session.take() {
|
||||
// TODO: Needs testing
|
||||
session.disconnect(None);
|
||||
}
|
||||
app.tray_handle().set_menu(signed_out_menu())?;
|
||||
}
|
||||
Req::UpdateResources(resources) => {
|
||||
tracing::debug!("controller got UpdateResources");
|
||||
let resources: Vec<_> = resources.into_iter().map(ResourceDisplay::from).collect();
|
||||
|
||||
Reference in New Issue
Block a user