Skip to content

Commit

Permalink
Fix multiple threads reading stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Apr 25, 2020
1 parent ab33954 commit f78bb03
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Agent/Services/ChatClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public async Task SendMessage(string message, string orgName, string senderConne
return;
}
chatSession = new ChatSession() { PipeStream = clientPipe, ProcessID = procID };
_ = Task.Run(async () => { await ReadFromStream(chatSession.PipeStream, senderConnectionID, hubConnection); });
ChatClients.Add(senderConnectionID, chatSession, CacheItemPolicy);
}

Expand All @@ -69,8 +70,6 @@ public async Task SendMessage(string message, string orgName, string senderConne
await sw.WriteLineAsync(message);
await sw.FlushAsync();
}

_ = Task.Run(async () => { await ReadFromStream(chatSession.PipeStream, senderConnectionID, hubConnection); });
}
}
catch (Exception ex)
Expand Down

0 comments on commit f78bb03

Please sign in to comment.