mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
Leave SyncPlay group on session disconnect.
This commit is contained in:
parent
224c48821e
commit
e4691d45f5
@ -87,7 +87,7 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||
_sessionManager = sessionManager;
|
||||
_libraryManager = libraryManager;
|
||||
_logger = loggerFactory.CreateLogger<SyncPlayManager>();
|
||||
_sessionManager.SessionControllerConnected += OnSessionControllerConnected;
|
||||
_sessionManager.SessionEnded += OnSessionEnded;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -352,18 +352,18 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||
return;
|
||||
}
|
||||
|
||||
_sessionManager.SessionControllerConnected -= OnSessionControllerConnected;
|
||||
_sessionManager.SessionEnded -= OnSessionEnded;
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
private void OnSessionControllerConnected(object sender, SessionEventArgs e)
|
||||
private void OnSessionEnded(object sender, SessionEventArgs e)
|
||||
{
|
||||
var session = e.SessionInfo;
|
||||
|
||||
if (_sessionToGroupMap.TryGetValue(session.Id, out var group))
|
||||
{
|
||||
var request = new JoinGroupRequest(group.GroupId);
|
||||
JoinGroup(session, request, CancellationToken.None);
|
||||
var leaveGroupRequest = new LeaveGroupRequest();
|
||||
LeaveGroup(session, leaveGroupRequest, CancellationToken.None);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user