Skip to content

Commit

Permalink
fix unstable test case
Browse files Browse the repository at this point in the history
  • Loading branch information
smdn committed Jul 4, 2024
1 parent 0eedb78 commit 95cd021
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,14 @@ private async Task SendAsync(CancellationToken stopToken)
if (buffer.IsEmpty && read.IsCompleted)
break;

// ignore cancellation request until the read content is written to the sentDataBuffer
var cancellationTokenForWritingSentData = CancellationToken.None;

foreach (var segment in buffer) {
await sentDataBuffer.WriteAsync(segment, stopToken).ConfigureAwait(false);
await sentDataBuffer.WriteAsync(segment, cancellationTokenForWritingSentData).ConfigureAwait(false);
}

await sentDataBuffer.FlushAsync(stopToken).ConfigureAwait(false);
await sentDataBuffer.FlushAsync(cancellationTokenForWritingSentData).ConfigureAwait(false);

sendPipe.Reader.AdvanceTo(buffer.End);
}
Expand Down

0 comments on commit 95cd021

Please sign in to comment.