Synchronize muted channel state
This commit is contained in:
committed by
Brandon McGinty
parent
118799d112
commit
20c6997ab0
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user