aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Session/WebSocketController.cs
diff options
context:
space:
mode:
authorJinYi-Tsinghua <109143373+JinYi-Tsinghua@users.noreply.github.com>2022-08-29 02:32:16 +0000
committerGitHub <noreply@github.com>2022-08-29 02:32:16 +0000
commitf1bfbff9530d6b04518b7a601a1015c7a8d1443e (patch)
treeeedd01e775ab5b0d2852483584b786dfcac38996 /Emby.Server.Implementations/Session/WebSocketController.cs
parenta94aec9b326935bc9583f74f3f3c15df0139cf24 (diff)
parent2b285b787408417b4ae1f8e3f364b2e5e0a66207 (diff)
Merge pull request #1 from JinYi-Tsinghua/patch-1
Patch 1
Diffstat (limited to 'Emby.Server.Implementations/Session/WebSocketController.cs')
-rw-r--r--Emby.Server.Implementations/Session/WebSocketController.cs19
1 files changed, 18 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs
index d21b6a929..1f3248f07 100644
--- a/Emby.Server.Implementations/Session/WebSocketController.cs
+++ b/Emby.Server.Implementations/Session/WebSocketController.cs
@@ -14,7 +14,7 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Session
{
- public sealed class WebSocketController : ISessionController, IDisposable
+ public sealed class WebSocketController : ISessionController, IAsyncDisposable, IDisposable
{
private readonly ILogger<WebSocketController> _logger;
private readonly ISessionManager _sessionManager;
@@ -99,6 +99,23 @@ namespace Emby.Server.Implementations.Session
foreach (var socket in _sockets)
{
socket.Closed -= OnConnectionClosed;
+ socket.Dispose();
+ }
+
+ _disposed = true;
+ }
+
+ public async ValueTask DisposeAsync()
+ {
+ if (_disposed)
+ {
+ return;
+ }
+
+ foreach (var socket in _sockets)
+ {
+ socket.Closed -= OnConnectionClosed;
+ await socket.DisposeAsync().ConfigureAwait(false);
}
_disposed = true;