1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-29 15:51:01 +02:00

Make client count independant of outputs

This commit is contained in:
Alexandre Iooss
2020-10-17 16:17:19 +02:00
parent 70798ce1df
commit f0990a630d
3 changed files with 24 additions and 16 deletions

View File

@ -16,7 +16,8 @@ func TestWithOneOutput(t *testing.T) {
// Register one output
output := make(chan []byte, 64)
stream.Register(output, false)
stream.Register(output)
stream.IncrementClientCount()
// Try to pass one message
stream.Broadcast <- []byte("hello world")
@ -26,15 +27,16 @@ func TestWithOneOutput(t *testing.T) {
}
// Check client count
if count := stream.Count(); count != 1 {
if count := stream.ClientCount(); count != 1 {
t.Errorf("Client counter returned %d, expected 1", count)
}
// Unregister
stream.Unregister(output, false)
stream.Unregister(output)
stream.DecrementClientCount()
// Check client count
if count := stream.Count(); count != 0 {
if count := stream.ClientCount(); count != 0 {
t.Errorf("Client counter returned %d, expected 0", count)
}
}