Skip to content

Commit

Permalink
no loop is required for SendAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryjiang committed Jan 11, 2025
1 parent 8b8aff9 commit a408d9c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/SuperSocket.Connection/PipeConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,12 @@ protected async ValueTask<bool> ProcessOutputRead(PipeReader reader)
var buffer = result.Buffer;
var end = buffer.End;

while (!buffer.IsEmpty)
if (!buffer.IsEmpty)
{
try
{
var bytesToSend = buffer.Length;
var bytesSent = await SendOverIOAsync(buffer, CancellationToken.None).ConfigureAwait(false);
await SendOverIOAsync(buffer, CancellationToken.None).ConfigureAwait(false);
UpdateLastActiveTime();

if (bytesSent == bytesToSend)
{
break;
}

buffer = buffer.Slice(bytesSent);
}
catch (Exception e)
{
Expand Down

0 comments on commit a408d9c

Please sign in to comment.