From 9b8311ffcb874568497e3599302fb4e81064fa70 Mon Sep 17 00:00:00 2001 From: Raja Subramanian Date: Sat, 31 Dec 2022 11:43:48 +0530 Subject: [PATCH] No JoinResponse during migration (#1277) * No JoinResponse during migration * Change to take migration into account --- pkg/rtc/participant.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/rtc/participant.go b/pkg/rtc/participant.go index 844947973..81994bc54 100644 --- a/pkg/rtc/participant.go +++ b/pkg/rtc/participant.go @@ -254,6 +254,14 @@ func (p *ParticipantImpl) ProtocolVersion() types.ProtocolVersion { func (p *ParticipantImpl) IsReady() bool { state := p.State() + + // when migrating, there is no JoinResponse, state transitions from JOINING -> ACTIVE -> DISCONNECTED + // so JOINING is considered ready. + if p.params.Migration { + return state != livekit.ParticipantInfo_DISCONNECTED + } + + // when not migrating, there is a JoinResponse, state transitions from JOINING -> JOINED -> ACTIVE -> DISCONNECTED return state == livekit.ParticipantInfo_JOINED || state == livekit.ParticipantInfo_ACTIVE }