mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
fix(rust/gui-client): ignore network resets before the tunnel is ready (#6458)
Closes #6457 This PR ignores `Session::reset` requests from the GUI while the IPC service is still raising the tunnel. This removes redundant reconnections to the Portal and it may improve behavior on some systems. It's not any faster on my dev laptop. `set_dns` seemed harmless so I didn't touch that. --------- Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com> Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
This commit is contained in:
@@ -399,6 +399,10 @@ impl<'a> Handler<'a> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn tunnel_is_ready(&self) -> bool {
|
||||
self.last_connlib_start_instant.is_none() && self.connlib.is_some()
|
||||
}
|
||||
|
||||
async fn handle_ipc_msg(&mut self, msg: ClientMsg) -> Result<()> {
|
||||
match msg {
|
||||
ClientMsg::ClearLogs => {
|
||||
@@ -433,12 +437,20 @@ impl<'a> Handler<'a> {
|
||||
let filter = spawn_blocking(get_log_filter).await??;
|
||||
self.log_filter_reloader.reload(filter)?;
|
||||
}
|
||||
ClientMsg::Reset => self.connlib.as_mut().context("No connlib session")?.reset(),
|
||||
ClientMsg::SetDns(v) => self
|
||||
.connlib
|
||||
.as_mut()
|
||||
.context("No connlib session")?
|
||||
.set_dns(v),
|
||||
ClientMsg::Reset => {
|
||||
if self.tunnel_is_ready() {
|
||||
self.connlib.as_mut().context("No connlib session")?.reset();
|
||||
} else {
|
||||
tracing::debug!("Ignoring redundant reset");
|
||||
}
|
||||
}
|
||||
ClientMsg::SetDns(resolvers) => {
|
||||
tracing::debug!(?resolvers);
|
||||
self.connlib
|
||||
.as_mut()
|
||||
.context("No connlib session")?
|
||||
.set_dns(resolvers)
|
||||
}
|
||||
ClientMsg::SetDisabledResources(disabled_resources) => {
|
||||
self.connlib
|
||||
.as_mut()
|
||||
|
||||
Reference in New Issue
Block a user