Synchronize connection and transmission state

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-10 00:45:22 -04:00
committed by Brandon McGinty
parent 3efbd019ce
commit 55772fa459
4 changed files with 64 additions and 23 deletions
+16
View File
@@ -84,6 +84,22 @@ func TestServerAddressDefaultsPortWithoutBreakingIPv6(t *testing.T) {
}
}
func TestConcurrentConnectionStateAccess(t *testing.T) {
b := &Barnard{}
var wg sync.WaitGroup
for i := 0; i < 20; i++ {
wg.Add(1)
go func(value bool) {
defer wg.Done()
b.setConnected(value)
b.setTransmitting(value)
_ = b.isConnected()
_ = b.isTransmitting()
}(i%2 == 0)
}
wg.Wait()
}
func TestConcurrentSelectedUserAccess(t *testing.T) {
b := &Barnard{}
user := &gumble.User{Session: 1}