@@ -792,13 +792,13 @@ public class Call(
792792 if (joinResponse is Success ) {
793793 // switch to the new SFU
794794 val cred = joinResponse.value.credentials
795- val session = this .session!!
795+ val oldSession = this .session!!
796796 val oldSessionStats = collectStats()
797797 val currentOptions = this .session?.publisher?.currentOptions()
798- logger.i { " Rejoin SFU ${session ?.sfuUrl} to ${cred.server.url} " }
798+ logger.i { " Rejoin SFU ${oldSession ?.sfuUrl} to ${cred.server.url} " }
799799
800800 this .sessionId = UUID .randomUUID().toString()
801- val (prevSessionId, subscriptionsInfo, publishingInfo) = session .currentSfuInfo()
801+ val (prevSessionId, subscriptionsInfo, publishingInfo) = oldSession .currentSfuInfo()
802802 val reconnectDetails = ReconnectDetails (
803803 previous_session_id = prevSessionId,
804804 strategy = WebsocketReconnectStrategy .WEBSOCKET_RECONNECT_STRATEGY_REJOIN ,
@@ -808,7 +808,7 @@ public class Call(
808808 reason = reason,
809809 )
810810 this .state.removeParticipant(prevSessionId)
811- session .prepareRejoin()
811+ oldSession .prepareRejoin()
812812 try {
813813 this .session = RtcSession (
814814 clientImpl,
@@ -827,8 +827,9 @@ public class Call(
827827 )
828828 this .session?.connect(reconnectDetails, currentOptions)
829829 this .session?.sfuTracer?.trace(" rejoin" , reason)
830- session.sendCallStats(oldSessionStats)
831- session.cleanup()
830+ oldSession.sendCallStats(oldSessionStats)
831+ oldSession.leaveWithReason(" Rejoin :: $reason " )
832+ oldSession.cleanup()
832833 monitorSession(joinResponse.value)
833834 } catch (ex: Exception ) {
834835 logger.e(ex) {
@@ -924,10 +925,10 @@ public class Call(
924925 /* * Leave the call, but don't end it for other users */
925926 fun leave (reason : String = "user") {
926927 logger.d { " [leave] #ringing; no args, call_cid:$cid " }
927- leave (null , reason)
928+ internalLeave (null , reason)
928929 }
929930
930- private fun leave (disconnectionReason : Throwable ? , reason : String ) = atomicLeave {
931+ private fun internalLeave (disconnectionReason : Throwable ? , reason : String ) = atomicLeave {
931932 val callId = id
932933 monitorSubscriberPCStateJob?.cancel()
933934 monitorPublisherPCStateJob?.cancel()
0 commit comments