add tests to ensure subscriber cleanup

This commit is contained in:
David Zhao
2021-05-12 23:52:41 -07:00
parent bbadd4ccb6
commit c76cdf11c2
7 changed files with 116 additions and 0 deletions
+6
View File
@@ -88,6 +88,12 @@ func (t *DataTrack) OnClose(f func()) {
t.onClose = f
}
func (t *DataTrack) IsSubscriber(subId string) bool {
t.lock.RLock()
defer t.lock.RUnlock()
return t.subscribers[subId] != nil
}
func (t *DataTrack) AddSubscriber(participant types.Participant) error {
t.lock.Lock()
defer t.lock.Unlock()