Skip to content

Commit

Permalink
Properly name the client
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 committed Sep 21, 2021
1 parent 0cb36a2 commit 5b8c17c
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ protected override void Dispose(bool isDisposing)

private class TestBroadcastClient : IDisposable
{
private readonly NamedPipeClientStream pipeServer;
private readonly NamedPipeClientStream pipeClient;

private readonly SpriteText text;

private bool running = true;

public bool IsClientConnected => pipeServer.IsConnected;
public bool IsClientConnected => pipeClient.IsConnected;

private readonly Thread readThread;

public TestBroadcastClient(SpriteText outputText)
{
text = outputText;
pipeServer = new NamedPipeClientStream(".", "senPipe",
pipeClient = new NamedPipeClientStream(".", "senPipe",
PipeDirection.In, PipeOptions.Asynchronous,
TokenImpersonationLevel.Impersonation);

Expand All @@ -71,19 +71,19 @@ private void clientLoop()
{
while (running)
{
if (!pipeServer.IsConnected)
if (!pipeClient.IsConnected)
{
try
{
pipeServer.ConnectAsync().Wait(cancellationToken);
pipeClient.ConnectAsync().Wait(cancellationToken);
}
catch (OperationCanceledException)
{
break;
}
}

TransmissionData packet = new TransmissionData((byte)pipeServer.ReadByte());
TransmissionData packet = new TransmissionData((byte)pipeClient.ReadByte());

// Server has shut down
if (packet == TransmissionData.Kill)
Expand All @@ -98,7 +98,7 @@ public void Dispose()
{
running = false;
cancellationTokenSource.Cancel();
pipeServer.Dispose();
pipeClient.Dispose();
}
}
}
Expand Down

0 comments on commit 5b8c17c

Please sign in to comment.