mirror of
https://github.com/livekit/livekit.git
synced 2026-10-06 01:18:02 +00:00
rtc: split EndSession out of MoveToRoom (#4917)
* rtc: split EndSession out of MoveToRoom A participant's session in a room can end without the participant closing: today on a move, and next on a room re-key, where a room ended by the sweeper while participants were joining restarts under a new room id with the same participants in it. EndSession is the room-independent half of MoveToRoom: report the published tracks unpublished, report the session end, run the caller's leave under the ending session's telemetry guard, then take a fresh guard and reset the deferred resolvers for the next session. The guard matters: ParticipantLeft releases it and the telemetry service refuses to open a stats worker for a released guard, so without a fresh one the next session's join would silently get no worker. MoveToRoom keeps the subscriber teardown and the onClose fan-out, passed in as the leave. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * rtc: rename EndSession to LeaveSession, add JoinSession EndSession read as terminal, but the participant survives it and joins another session, so name the pair for what happens to the participant: LeaveSession and JoinSession. JoinSession is the other half that review pointed out was missing from the API: the caller reports the join, then the published tracks are reported published again under the new session, pairing the unpublish LeaveSession reported. Without it the re-publish lived only in the caller, with nothing in OSS proving the two halves balance. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
93f5b3eb61
commit
6cfd19bd9b
@@ -608,6 +608,8 @@ type LocalParticipant interface {
|
||||
)
|
||||
IsReconnect() bool
|
||||
IsMigration() bool
|
||||
LeaveSession(leave func())
|
||||
JoinSession(join func())
|
||||
MoveToRoom(params MoveToRoomParams)
|
||||
|
||||
UpdateMediaRTT(rtt uint32)
|
||||
|
||||
@@ -1011,6 +1011,11 @@ type FakeLocalParticipant struct {
|
||||
issueFullReconnectArgsForCall []struct {
|
||||
arg1 types.ParticipantCloseReason
|
||||
}
|
||||
JoinSessionStub func(func())
|
||||
joinSessionMutex sync.RWMutex
|
||||
joinSessionArgsForCall []struct {
|
||||
arg1 func()
|
||||
}
|
||||
KindStub func() livekit.ParticipantInfo_Kind
|
||||
kindMutex sync.RWMutex
|
||||
kindArgsForCall []struct {
|
||||
@@ -1031,6 +1036,11 @@ type FakeLocalParticipant struct {
|
||||
kindDetailsReturnsOnCall map[int]struct {
|
||||
result1 []livekit.ParticipantInfo_KindDetail
|
||||
}
|
||||
LeaveSessionStub func(func())
|
||||
leaveSessionMutex sync.RWMutex
|
||||
leaveSessionArgsForCall []struct {
|
||||
arg1 func()
|
||||
}
|
||||
MaybeStartMigrationStub func(bool, func()) bool
|
||||
maybeStartMigrationMutex sync.RWMutex
|
||||
maybeStartMigrationArgsForCall []struct {
|
||||
@@ -6919,6 +6929,38 @@ func (fake *FakeLocalParticipant) IssueFullReconnectArgsForCall(i int) types.Par
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) JoinSession(arg1 func()) {
|
||||
fake.joinSessionMutex.Lock()
|
||||
fake.joinSessionArgsForCall = append(fake.joinSessionArgsForCall, struct {
|
||||
arg1 func()
|
||||
}{arg1})
|
||||
stub := fake.JoinSessionStub
|
||||
fake.recordInvocation("JoinSession", []interface{}{arg1})
|
||||
fake.joinSessionMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.JoinSessionStub(arg1)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) JoinSessionCallCount() int {
|
||||
fake.joinSessionMutex.RLock()
|
||||
defer fake.joinSessionMutex.RUnlock()
|
||||
return len(fake.joinSessionArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) JoinSessionCalls(stub func(func())) {
|
||||
fake.joinSessionMutex.Lock()
|
||||
defer fake.joinSessionMutex.Unlock()
|
||||
fake.JoinSessionStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) JoinSessionArgsForCall(i int) func() {
|
||||
fake.joinSessionMutex.RLock()
|
||||
defer fake.joinSessionMutex.RUnlock()
|
||||
argsForCall := fake.joinSessionArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) Kind() livekit.ParticipantInfo_Kind {
|
||||
fake.kindMutex.Lock()
|
||||
ret, specificReturn := fake.kindReturnsOnCall[len(fake.kindArgsForCall)]
|
||||
@@ -7025,6 +7067,38 @@ func (fake *FakeLocalParticipant) KindDetailsReturnsOnCall(i int, result1 []live
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) LeaveSession(arg1 func()) {
|
||||
fake.leaveSessionMutex.Lock()
|
||||
fake.leaveSessionArgsForCall = append(fake.leaveSessionArgsForCall, struct {
|
||||
arg1 func()
|
||||
}{arg1})
|
||||
stub := fake.LeaveSessionStub
|
||||
fake.recordInvocation("LeaveSession", []interface{}{arg1})
|
||||
fake.leaveSessionMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.LeaveSessionStub(arg1)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) LeaveSessionCallCount() int {
|
||||
fake.leaveSessionMutex.RLock()
|
||||
defer fake.leaveSessionMutex.RUnlock()
|
||||
return len(fake.leaveSessionArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) LeaveSessionCalls(stub func(func())) {
|
||||
fake.leaveSessionMutex.Lock()
|
||||
defer fake.leaveSessionMutex.Unlock()
|
||||
fake.LeaveSessionStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) LeaveSessionArgsForCall(i int) func() {
|
||||
fake.leaveSessionMutex.RLock()
|
||||
defer fake.leaveSessionMutex.RUnlock()
|
||||
argsForCall := fake.leaveSessionArgsForCall[i]
|
||||
return argsForCall.arg1
|
||||
}
|
||||
|
||||
func (fake *FakeLocalParticipant) MaybeStartMigration(arg1 bool, arg2 func()) bool {
|
||||
fake.maybeStartMigrationMutex.Lock()
|
||||
ret, specificReturn := fake.maybeStartMigrationReturnsOnCall[len(fake.maybeStartMigrationArgsForCall)]
|
||||
|
||||
Reference in New Issue
Block a user