Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Sep 28, 2024
1 parent af891fa commit ce3b6dc
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions JL.Core/Network/WebSocketUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ private static void ListenWebSocket(CancellationToken cancellationToken)
{
using ClientWebSocket webSocketClient = new();
await webSocketClient.ConnectAsync(CoreConfigManager.WebSocketUri, CancellationToken.None).ConfigureAwait(false);
Memory<byte> buffer = new byte[1024];

// 256-4096
Memory<byte> buffer = new byte[1024 * 4];

while (CoreConfigManager.CaptureTextFromWebSocket && !cancellationToken.IsCancellationRequested && webSocketClient.State is WebSocketState.Open)
{
Expand Down Expand Up @@ -85,13 +87,6 @@ private static void ListenWebSocket(CancellationToken cancellationToken)
StatsUtils.StopStatsTimer();
}
}
else
{
if (CoreConfigManager.CaptureTextFromWebSocket && !cancellationToken.IsCancellationRequested)
{
await Task.Delay(200).ConfigureAwait(false);
}
}

if (CoreConfigManager.CaptureTextFromWebSocket && !cancellationToken.IsCancellationRequested)
{
Expand Down Expand Up @@ -123,10 +118,6 @@ private static void ListenWebSocket(CancellationToken cancellationToken)
else
{
Utils.Logger.Verbose(webSocketException, "Couldn't connect to the WebSocket server, probably because it is not running");
if (CoreConfigManager.CaptureTextFromWebSocket && !cancellationToken.IsCancellationRequested)
{
await Task.Delay(200).ConfigureAwait(false);
}
}
}
}
Expand Down

0 comments on commit ce3b6dc

Please sign in to comment.