Skip to content

Commit

Permalink
Workaround for ReadAllAsync()
Browse files Browse the repository at this point in the history
  • Loading branch information
greymistcube committed Nov 25, 2024
1 parent dd93cf4 commit 7c26f68
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Libplanet.Net/Transports/NetMQTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,26 @@ await ProcessMessageHandler.InvokeAsync(
channel.Writer.Complete();
}

#if NETCOREAPP3_0 || NETCOREAPP3_1 || NET
await foreach (
var messageContent in channel.Reader.ReadAllAsync(
_runtimeCancellationTokenSource.Token))
{
#else
while (true)
{
MessageContent messageContent;
try
{
messageContent = await channel.Reader.ReadAsync(
_runtimeCancellationTokenSource.Token);
}
catch (ChannelClosedException)
{
break;
}

#endif
await ReplyMessageAsync(
messageContent,
message.Identity ?? Array.Empty<byte>(),
Expand Down

0 comments on commit 7c26f68

Please sign in to comment.