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
+7 -2
View File
@@ -33,6 +33,11 @@ func (r *LocalRouter) SetNodeForRoom(roomName string, nodeId string) error {
return nil
}
func (r *LocalRouter) ClearRoomState(roomName string) error {
// do nothing
return nil
}
func (r *LocalRouter) RegisterNode() error {
return nil
}
@@ -105,11 +110,11 @@ func (r *LocalRouter) getOrCreateMessageChannel(target map[string]*MessageChanne
}
mc = NewMessageChannel()
mc.onClose = func() {
mc.OnClose(func() {
r.lock.Lock()
delete(target, participantId)
r.lock.Unlock()
}
})
r.lock.Lock()
target[participantId] = mc
r.lock.Unlock()