diff options
| author | Bond-009 <bond.009@outlook.com> | 2023-02-19 15:08:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-19 15:08:35 +0100 |
| commit | bb6f867067aad14c12a77bd1f9f5292f75d7bbfb (patch) | |
| tree | 30471bc873fb0ebb93676938d600af13d7208af8 /Emby.Server.Implementations/Session/SessionWebSocketListener.cs | |
| parent | de96fe1f521a9869544f4550fa2e7186f192fcd3 (diff) | |
| parent | cb85fc688f84de928e046cb6bd02629f04d68df6 (diff) | |
Merge pull request #9322 from Bond-009/nullable
Diffstat (limited to 'Emby.Server.Implementations/Session/SessionWebSocketListener.cs')
| -rw-r--r-- | Emby.Server.Implementations/Session/SessionWebSocketListener.cs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs index aebb55907..4e427b1a4 100644 --- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs +++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -58,7 +56,7 @@ namespace Emby.Server.Implementations.Session /// <summary> /// The KeepAlive cancellation token. /// </summary> - private CancellationTokenSource _keepAliveCancellationToken; + private CancellationTokenSource? _keepAliveCancellationToken; /// <summary> /// Initializes a new instance of the <see cref="SessionWebSocketListener" /> class. @@ -105,7 +103,7 @@ namespace Emby.Server.Implementations.Session } } - private async Task<SessionInfo> GetSession(HttpContext httpContext, string remoteEndpoint) + private async Task<SessionInfo?> GetSession(HttpContext httpContext, string? remoteEndpoint) { if (!httpContext.User.Identity?.IsAuthenticated ?? false) { @@ -138,8 +136,13 @@ namespace Emby.Server.Implementations.Session /// </summary> /// <param name="sender">The WebSocket.</param> /// <param name="e">The event arguments.</param> - private void OnWebSocketClosed(object sender, EventArgs e) + private void OnWebSocketClosed(object? sender, EventArgs e) { + if (sender is null) + { + return; + } + var webSocket = (IWebSocketConnection)sender; _logger.LogDebug("WebSocket {0} is closed.", webSocket); RemoveWebSocket(webSocket); |
