From 95cd021b7b0d1322495933ce1b6818c56a60606b Mon Sep 17 00:00:00 2001 From: smdn Date: Thu, 4 Jul 2024 23:52:56 +0900 Subject: [PATCH] fix unstable test case --- .../Smdn.Net.SkStackIP/SkStackDuplexPipe.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/Smdn.Net.SkStackIP/Smdn.Net.SkStackIP/SkStackDuplexPipe.cs b/tests/Smdn.Net.SkStackIP/Smdn.Net.SkStackIP/SkStackDuplexPipe.cs index 0f7ecbd..45f062f 100644 --- a/tests/Smdn.Net.SkStackIP/Smdn.Net.SkStackIP/SkStackDuplexPipe.cs +++ b/tests/Smdn.Net.SkStackIP/Smdn.Net.SkStackIP/SkStackDuplexPipe.cs @@ -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); }