reuse the same Participant ID within the same room/session

This commit is contained in:
David Zhao
2021-01-28 01:14:06 -08:00
parent 0e48711e4b
commit fe83baa662
10 changed files with 232 additions and 17 deletions
+35
View File
@@ -0,0 +1,35 @@
package routing_test
import (
"sync"
"testing"
"github.com/livekit/livekit-server/pkg/routing"
"github.com/livekit/livekit-server/proto/livekit"
)
func TestMessageChannel_WriteMessageClosed(t *testing.T) {
// ensure it doesn't panic when written to after closing
m := routing.NewMessageChannel()
go func() {
for msg := range m.ReadChan() {
if msg == nil {
return
}
}
}()
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
defer wg.Done()
for i := 0; i < 100; i++ {
m.WriteMessage(&livekit.RouterMessage{})
}
}()
m.WriteMessage(&livekit.RouterMessage{})
m.Close()
m.WriteMessage(&livekit.RouterMessage{})
wg.Wait()
}