aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Session/WebSocketController.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-11-15 13:12:43 -0700
committercrobibero <cody@robibe.ro>2020-11-15 13:12:43 -0700
commit4b15284324cf65bc916a3112b7fc61c958ac70c5 (patch)
treee125c2e1f04526509cc6f0c72e7e922c4276e02e /Emby.Server.Implementations/Session/WebSocketController.cs
parent7ff212576e1fba5980163bcc1cd97c29aadc635f (diff)
parent2f426dfc97677deffb60420078b20a7f5f03977e (diff)
Merge remote-tracking branch 'upstream/master' into bye-tvdb
Diffstat (limited to 'Emby.Server.Implementations/Session/WebSocketController.cs')
-rw-r--r--Emby.Server.Implementations/Session/WebSocketController.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs
index b986ffa1c..f9c6a13c6 100644
--- a/Emby.Server.Implementations/Session/WebSocketController.cs
+++ b/Emby.Server.Implementations/Session/WebSocketController.cs
@@ -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;