mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
fix(gui-client): remove error about unexpected TunnelReady (#7497)
The communication between the GUI client, the IPC service and `connlib` are asynchronous. As such, it may happen that the state machines run out of sync. Receiving a `TunnelReady` despite not being in the right state for that is no concern and can be handled gracefully.
This commit is contained in:
@@ -598,21 +598,17 @@ impl<'a, I: GuiIntegration> Controller<'a, I> {
|
||||
Err(Error::IpcServiceTerminating)?
|
||||
}
|
||||
IpcServerMsg::TunnelReady => {
|
||||
if self.auth.session().is_none() {
|
||||
// This could maybe happen if the user cancels the sign-in
|
||||
// before it completes. This is because the state machine
|
||||
// between the GUI, the IPC service, and connlib isn't perfectly synced.
|
||||
tracing::error!("Got `TunnelReady` while signed out");
|
||||
let Status::WaitingForTunnel { start_instant } = self.status else {
|
||||
// If we are not waiting for a tunnel, continue.
|
||||
return Ok(ControlFlow::Continue(()));
|
||||
}
|
||||
if let Status::WaitingForTunnel { start_instant } = self.status {
|
||||
tracing::info!(elapsed = ?start_instant.elapsed(), "Tunnel ready");
|
||||
self.status = Status::TunnelReady { resources: vec![] };
|
||||
self.integration.show_notification(
|
||||
"Firezone connected",
|
||||
"You are now signed in and able to access resources.",
|
||||
)?;
|
||||
}
|
||||
};
|
||||
|
||||
tracing::info!(elapsed = ?start_instant.elapsed(), "Tunnel ready");
|
||||
self.status = Status::TunnelReady { resources: vec![] };
|
||||
self.integration.show_notification(
|
||||
"Firezone connected",
|
||||
"You are now signed in and able to access resources.",
|
||||
)?;
|
||||
self.refresh_system_tray_menu();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user