cleanup room state, proper participant termination

This commit is contained in:
David Zhao
2021-01-18 23:44:59 -08:00
parent d83a1b1af3
commit 71b4673a0a
22 changed files with 374 additions and 101 deletions
+20
View File
@@ -0,0 +1,20 @@
package routing
import (
"github.com/thoas/go-funk"
"github.com/livekit/livekit-server/proto/livekit"
)
type RandomSelector struct {
}
func (s *RandomSelector) SelectNode(nodes []*livekit.Node, room *livekit.Room) (*livekit.Node, error) {
nodes = GetAvailableNodes(nodes)
if len(nodes) == 0 {
return nil, ErrNoAvailableNodes
}
idx := funk.RandomInt(0, len(nodes))
return nodes[idx], nil
}