Skip to content

Commit

Permalink
Tweaks for large outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan committed Oct 14, 2024
1 parent a7cdde1 commit 6801a7c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Listeners/UnixLogListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private async Task ProcessMessages()
{
try
{
bytesRead = await fs.ReadAsync(buffer);
bytesRead = await fs.ReadAsync(buffer.AsMemory(0, BUFFER_SIZE));
if (bytesRead <= 0)
{
await Task.Delay(50);
Expand Down Expand Up @@ -108,6 +108,8 @@ private async Task ProcessMessages()
eolIndex = 0;
}
}

buffer = new byte[BUFFER_SIZE];
}
catch (Exception ex)
{
Expand Down
8 changes: 4 additions & 4 deletions Listeners/WindowsLogListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ namespace GTerm.Listeners

internal class WindowsLogListener : ILogListener
{
private const int BUFFER_SIZE = 8192;
private readonly byte[] Buffer = new byte[BUFFER_SIZE];
private const int BUFFER_SIZE = 16384; // max buffer size as per xconsole Windows named pipe
private readonly NamedPipeClientStream Pipe;

public event EventHandler? OnConnected;
Expand Down Expand Up @@ -66,10 +65,11 @@ private async Task ProcessMessages()
{
try
{
int read = await this.Pipe.ReadAsync(this.Buffer.AsMemory(0, BUFFER_SIZE));
byte[] buffer = new byte[BUFFER_SIZE];
int read = await this.Pipe.ReadAsync(buffer.AsMemory(0, BUFFER_SIZE));
if (read == 0) continue;

using (BinaryReader reader = new(new MemoryStream(this.Buffer, 0, read)))
using (BinaryReader reader = new(new MemoryStream(buffer, 0, read)))
{
int type = reader.ReadInt32();
int level = reader.ReadInt32();
Expand Down
Binary file modified Modules/gmsv_xconsole_win32.dll
Binary file not shown.
Binary file modified Modules/gmsv_xconsole_win64.dll
Binary file not shown.

0 comments on commit 6801a7c

Please sign in to comment.