Synchronize muted channel state

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-10 00:31:29 -04:00
committed by Brandon McGinty
parent 118799d112
commit 20c6997ab0
5 changed files with 46 additions and 14 deletions
+15
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"io"
"strings"
"sync"
"testing"
"time"
"unicode/utf8"
@@ -83,6 +84,20 @@ func TestServerAddressDefaultsPortWithoutBreakingIPv6(t *testing.T) {
}
}
func TestConcurrentMutedChannelAccess(t *testing.T) {
b := &Barnard{MutedChannels: make(map[uint32]bool)}
var wg sync.WaitGroup
for i := 0; i < 20; i++ {
wg.Add(1)
go func(i int) {
defer wg.Done()
b.setChannelMuted(uint32(i%3), i%2 == 0)
_ = b.isChannelMuted(uint32((i + 1) % 3))
}(i)
}
wg.Wait()
}
func TestPublicTextMessageTargetsChannelIDsAndTrees(t *testing.T) {
root := &gumble.Channel{ID: 1, Name: "Root"}
current := &gumble.Channel{ID: 2, Name: "Room", Parent: root}