fix(rust/gui-client/auth): destroy the connlib session on disconnect (#6795)

Closes #6791

We weren't closing the connlib session immediately when we get
`on_disconnect`, this patch fixes that.

This passes the manual test established in #6792. I also cycled through
sign-in, close, open, sign-out, and it looks fine.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
This commit is contained in:
Reactor Scram
2024-09-24 09:13:01 -05:00
committed by GitHub
parent f4554d2795
commit 86910f477d
2 changed files with 17 additions and 8 deletions

View File

@@ -375,14 +375,20 @@ impl<'a> Handler<'a> {
ConnlibMsg::OnDisconnect {
error_msg,
is_authentication_error,
} => self
.ipc_tx
.send(&ServerMsg::OnDisconnect {
error_msg,
is_authentication_error,
})
.await
.context("Error while sending IPC message `OnDisconnect`")?,
} => {
if let Some(session) = self.session.take() {
// Identical to dropping, but looks nicer
session.connlib.disconnect();
}
self.dns_controller.deactivate()?;
self.ipc_tx
.send(&ServerMsg::OnDisconnect {
error_msg,
is_authentication_error,
})
.await
.context("Error while sending IPC message `OnDisconnect`")?
}
ConnlibMsg::OnSetInterfaceConfig { ipv4, ipv6, dns } => {
self.tun_device.set_ips(ipv4, ipv6).await?;
self.dns_controller.set_dns(dns).await?;

View File

@@ -19,6 +19,9 @@ export default function GUI({ title }: { title: string }) {
<ChangeItem enable={title === "Linux GUI"} pull="6780">
Fixes a bug where the Linux Clients didn't work on ZFS filesystems
</ChangeItem>
<ChangeItem pull="6795">
Fixes a bug where auto-sign-in with an expired token would cause a "Couldn't send Disconnect" error message.
</ChangeItem>
</ul>
</Entry
*/}