Merge pull request #4710 from OancaAndrei/syncplay-fix-session-restore
Restore sessions in SyncPlay groups upon reconnection
This commit is contained in:
commit
a57e465de9
|
@ -128,6 +128,9 @@ namespace Emby.Server.Implementations.Session
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public event EventHandler<SessionEventArgs> SessionActivity;
|
public event EventHandler<SessionEventArgs> SessionActivity;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public event EventHandler<SessionEventArgs> SessionControllerConnected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all connections.
|
/// Gets all connections.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -312,6 +315,19 @@ namespace Emby.Server.Implementations.Session
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void OnSessionControllerConnected(SessionInfo info)
|
||||||
|
{
|
||||||
|
EventHelper.QueueEventIfNotNull(
|
||||||
|
SessionControllerConnected,
|
||||||
|
this,
|
||||||
|
new SessionEventArgs
|
||||||
|
{
|
||||||
|
SessionInfo = info
|
||||||
|
},
|
||||||
|
_logger);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void CloseIfNeeded(SessionInfo session)
|
public void CloseIfNeeded(SessionInfo session)
|
||||||
{
|
{
|
||||||
|
|
|
@ -133,6 +133,8 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
var controller = (WebSocketController)controllerInfo.Item1;
|
var controller = (WebSocketController)controllerInfo.Item1;
|
||||||
controller.AddWebSocket(connection);
|
controller.AddWebSocket(connection);
|
||||||
|
|
||||||
|
_sessionManager.OnSessionControllerConnected(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
_sessionManager = sessionManager;
|
_sessionManager = sessionManager;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_logger = loggerFactory.CreateLogger<SyncPlayManager>();
|
_logger = loggerFactory.CreateLogger<SyncPlayManager>();
|
||||||
_sessionManager.SessionStarted += OnSessionManagerSessionStarted;
|
_sessionManager.SessionControllerConnected += OnSessionControllerConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -329,11 +329,11 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_sessionManager.SessionStarted -= OnSessionManagerSessionStarted;
|
_sessionManager.SessionControllerConnected -= OnSessionControllerConnected;
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSessionManagerSessionStarted(object sender, SessionEventArgs e)
|
private void OnSessionControllerConnected(object sender, SessionEventArgs e)
|
||||||
{
|
{
|
||||||
var session = e.SessionInfo;
|
var session = e.SessionInfo;
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,11 @@ namespace MediaBrowser.Controller.Session
|
||||||
|
|
||||||
event EventHandler<SessionEventArgs> SessionActivity;
|
event EventHandler<SessionEventArgs> SessionActivity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when [session controller connected].
|
||||||
|
/// </summary>
|
||||||
|
event EventHandler<SessionEventArgs> SessionControllerConnected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when [capabilities changed].
|
/// Occurs when [capabilities changed].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -78,6 +83,12 @@ namespace MediaBrowser.Controller.Session
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
SessionInfo LogSessionActivity(string appName, string appVersion, string deviceId, string deviceName, string remoteEndPoint, Jellyfin.Data.Entities.User user);
|
SessionInfo LogSessionActivity(string appName, string appVersion, string deviceId, string deviceName, string remoteEndPoint, Jellyfin.Data.Entities.User user);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to report that a session controller has connected.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="session">The session.</param>
|
||||||
|
void OnSessionControllerConnected(SessionInfo session);
|
||||||
|
|
||||||
void UpdateDeviceName(string sessionId, string reportedDeviceName);
|
void UpdateDeviceName(string sessionId, string reportedDeviceName);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user