Make an IsDisconnected interface and use it (#1278)

This commit is contained in:
Raja Subramanian
2022-12-31 12:53:02 +05:30
committed by GitHub
parent 9b8311ffcb
commit 4ba7e57683
7 changed files with 86 additions and 81 deletions
+2 -2
View File
@@ -434,7 +434,7 @@ func (r *RoomManager) getOrCreateRoom(ctx context.Context, roomName livekit.Room
})
newRoom.OnParticipantChanged(func(p types.LocalParticipant) {
if p.State() != livekit.ParticipantInfo_DISCONNECTED {
if !p.IsDisconnected() {
if err := r.roomStore.StoreParticipant(ctx, roomName, p.ToProto()); err != nil {
newRoom.Logger.Errorw("could not handle participant change", err)
}
@@ -483,7 +483,7 @@ func (r *RoomManager) rtcSessionWorker(room *rtc.Room, participant types.LocalPa
select {
case <-stateCheckTicker.C:
// periodic check to ensure participant didn't become disconnected
if participant.State() == livekit.ParticipantInfo_DISCONNECTED {
if participant.IsDisconnected() {
return
}
case <-tokenTicker.C: