From 3d59a0eb3fccd30d3c917dd9b5d06c8e2f9efb5b Mon Sep 17 00:00:00 2001 From: Skip R Date: Tue, 13 Jan 2026 14:49:01 -0800 Subject: [PATCH] login/remoteauth: tolerate multiple attempts to cancel This will otherwise panic. --- pkg/connector/login_remoteauth.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/connector/login_remoteauth.go b/pkg/connector/login_remoteauth.go index 98b1657..b9f4a03 100644 --- a/pkg/connector/login_remoteauth.go +++ b/pkg/connector/login_remoteauth.go @@ -31,6 +31,7 @@ const LoginFlowIDRemoteAuth = "fi.mau.discord.login.remote_auth" type DiscordRemoteAuthLogin struct { *DiscordGenericLogin + hasClosed bool remoteAuthClient *remoteauth.Client qrChan chan string doneChan chan struct{} @@ -125,6 +126,12 @@ func (dl *DiscordRemoteAuthLogin) finalizeSuccessfulLogin(ctx context.Context, u } func (dl *DiscordRemoteAuthLogin) Cancel() { + // Tolerate multiple attempts to cancel. + if dl.hasClosed { + return + } + dl.hasClosed = true + dl.User.Log.Debug().Msg("Discord remoteauth cancelled") dl.DiscordGenericLogin.Cancel()