Synchronize connection and transmission state
This commit is contained in:
committed by
Brandon McGinty
parent
3efbd019ce
commit
55772fa459
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user