mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-16 15:24:10 +01:00
Merge branch 'master' into syncplay-enhanced
This commit is contained in:
@@ -58,8 +58,7 @@ namespace Emby.Server.Implementations.Session
|
||||
/// <summary>
|
||||
/// The active connections.
|
||||
/// </summary>
|
||||
private readonly ConcurrentDictionary<string, SessionInfo> _activeConnections =
|
||||
new ConcurrentDictionary<string, SessionInfo>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly ConcurrentDictionary<string, SessionInfo> _activeConnections = new (StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private Timer _idleTimer;
|
||||
|
||||
@@ -196,7 +195,7 @@ namespace Emby.Server.Implementations.Session
|
||||
{
|
||||
if (!string.IsNullOrEmpty(info.DeviceId))
|
||||
{
|
||||
var capabilities = GetSavedCapabilities(info.DeviceId);
|
||||
var capabilities = _deviceManager.GetCapabilities(info.DeviceId);
|
||||
|
||||
if (capabilities != null)
|
||||
{
|
||||
@@ -1675,27 +1674,10 @@ namespace Emby.Server.Implementations.Session
|
||||
SessionInfo = session
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
SaveCapabilities(session.DeviceId, capabilities);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error saving device capabilities", ex);
|
||||
}
|
||||
_deviceManager.SaveCapabilities(session.DeviceId, capabilities);
|
||||
}
|
||||
}
|
||||
|
||||
private ClientCapabilities GetSavedCapabilities(string deviceId)
|
||||
{
|
||||
return _deviceManager.GetCapabilities(deviceId);
|
||||
}
|
||||
|
||||
private void SaveCapabilities(string deviceId, ClientCapabilities capabilities)
|
||||
{
|
||||
_deviceManager.SaveCapabilities(deviceId, capabilities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a BaseItem to a BaseItemInfo.
|
||||
/// </summary>
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Net;
|
||||
@@ -55,9 +56,9 @@ namespace Emby.Server.Implementations.Session
|
||||
connection.Closed += OnConnectionClosed;
|
||||
}
|
||||
|
||||
private void OnConnectionClosed(object sender, EventArgs e)
|
||||
private void OnConnectionClosed(object? sender, EventArgs e)
|
||||
{
|
||||
var connection = (IWebSocketConnection)sender;
|
||||
var connection = sender as IWebSocketConnection ?? throw new ArgumentException($"{nameof(sender)} is not of type {nameof(IWebSocketConnection)}", nameof(sender));
|
||||
_logger.LogDebug("Removing websocket from session {Session}", _session.Id);
|
||||
_sockets.Remove(connection);
|
||||
connection.Closed -= OnConnectionClosed;
|
||||
|
||||
Reference in New Issue
Block a user