Fix multiple threads reading stream.

This commit is contained in:
Jared Goodwin 2020-04-25 16:05:51 -07:00
parent 8a1a4a5bdf
commit e899f9f6cf

View File

@ -52,6 +52,7 @@ namespace Remotely.Agent.Services
return;
}
chatSession = new ChatSession() { PipeStream = clientPipe, ProcessID = procID };
_ = Task.Run(async () => { await ReadFromStream(chatSession.PipeStream, senderConnectionID, hubConnection); });
ChatClients.Add(senderConnectionID, chatSession, CacheItemPolicy);
}
@ -69,8 +70,6 @@ namespace Remotely.Agent.Services
await sw.WriteLineAsync(message);
await sw.FlushAsync();
}
_ = Task.Run(async () => { await ReadFromStream(chatSession.PipeStream, senderConnectionID, hubConnection); });
}
}
catch (Exception ex)