Changed Collection to SynchronizedCollection
This commit is contained in:
parent
4d7b0e2b1e
commit
ef85dec657
@ -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<WebSocketService> _logger;
|
||||
private readonly BlockingCollection<WebSocket> _webSockets = new();
|
||||
private readonly SynchronizedCollection<WebSocket> _webSockets = new();
|
||||
|
||||
public WebSocketService(ILogger<WebSocketService> 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;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.ServiceModel.Primitives" Version="4.10.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user