Snapshot connected users under client lock

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 18:31:03 -04:00
committed by Brandon McGinty
parent 98a29a6470
commit 0766178277
2 changed files with 9 additions and 2 deletions
+7
View File
@@ -124,7 +124,14 @@ func (b *Barnard) OnConnect(e *gumble.ConnectEvent) {
b.UiTree.Rebuild() b.UiTree.Rebuild()
b.Ui.Refresh() b.Ui.Refresh()
var users []*gumble.User
b.Client.Do(func() {
users = make([]*gumble.User, 0, len(b.Client.Users))
for _, u := range b.Client.Users { for _, u := range b.Client.Users {
users = append(users, u)
}
})
for _, u := range users {
b.UserConfig.UpdateUser(u) b.UserConfig.UpdateUser(u)
b.rememberUserChannel(u) b.rememberUserChannel(u)
} }
+1 -1
View File
@@ -272,7 +272,7 @@ Priority 3: configuration, UI, and binding hardening
seconds for the protocol, creating a huge ban duration. Reject negative seconds for the protocol, creating a huge ban duration. Reject negative
durations and validate mask/address before sending. durations and validate mask/address before sending.
36. Admin, tree, and client code read mutable maps outside Client.Do [x] 36. Admin, tree, and client code read mutable maps outside Client.Do
Files: admin.go, ui_tree.go, client.go Files: admin.go, ui_tree.go, client.go
UI code ranges Client.Users, Channels, Channel.Users, and Children while UI code ranges Client.Users, Channels, Channel.Users, and Children while
network handlers mutate them. This overlaps issue 2 but must be fixed on network handlers mutate them. This overlaps issue 2 but must be fixed on