From b1033426263649229bc22bb4c3630e575f2f24f1 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Mon, 11 Nov 2024 16:54:59 +0100 Subject: [PATCH] Fix race condition with AutoKick. --- CHANGES | 2 ++ group/group.go | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 138c2fe..0e730e4 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,8 @@ Galene 0.95.0 (unreleased) incompatible change. * Added an id to every chat message, and made it possible to remove a single chat message. + * Fixed a race condition that prevented operators from joining an + AutoKick group. 15 July 2024: Galene 0.9.1 diff --git a/group/group.go b/group/group.go index b651b68..2a9b1f9 100644 --- a/group/group.go +++ b/group/group.go @@ -693,7 +693,17 @@ func autoLockKick(g *Group) { } if g.description.Autokick { - go kickall(g, "there are no operators in this group") + // we cannot call kickall, since it requires the group to + // be unlocked. And calling it asynchronously might + // spuriously kick out an operator. + go func(clients []Client) { + for _, c := range clients { + c.Kick( + "", nil, + "there are no operators in this group", + ) + } + }(g.getClientsUnlocked(nil)) } }