diff --git a/pac-man-board-game/Services/WebSocketService.cs b/pac-man-board-game/Services/WebSocketService.cs index 5ed71e4..9c096e6 100644 --- a/pac-man-board-game/Services/WebSocketService.cs +++ b/pac-man-board-game/Services/WebSocketService.cs @@ -1,4 +1,3 @@ -using System.Collections.Concurrent; using System.Net.WebSockets; using System.Text; using pacMan.Interfaces; @@ -9,7 +8,7 @@ namespace pacMan.Services; public class WebSocketService : IWebSocketService { private readonly ILogger _logger; - private readonly BlockingCollection _webSockets = new(); + private readonly SynchronizedCollection _webSockets = new(); public WebSocketService(ILogger logger) { @@ -23,9 +22,9 @@ public class WebSocketService : IWebSocketService _logger.Log(LogLevel.Debug, "WebSocket added to list"); } - public bool Remove(WebSocket? webSocket) + public bool Remove(WebSocket webSocket) { - var taken = _webSockets.TryTake(out webSocket); + var taken = _webSockets.Remove(webSocket); _logger.Log(LogLevel.Debug, "WebSocket removed from list"); return taken; } diff --git a/pac-man-board-game/pac-man-board-game.csproj b/pac-man-board-game/pac-man-board-game.csproj index f286054..1ae692c 100644 --- a/pac-man-board-game/pac-man-board-game.csproj +++ b/pac-man-board-game/pac-man-board-game.csproj @@ -20,6 +20,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive +