Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ await RunBidirectionalClientServer(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/55948")]
public async Task ReadOutstanding_ReadAborted_Throws()
{
// aborting doesn't work properly on mock
Expand All @@ -513,27 +512,31 @@ public async Task ReadOutstanding_ReadAborted_Throws()
return;
}

const int ExpectedErrorCode = 0xfffffff;

using SemaphoreSlim sem = new SemaphoreSlim(0);
(QuicConnection clientConnection, QuicConnection serverConnection) = await CreateConnectedQuicConnection();
using (clientConnection)
using (serverConnection)
{
byte[] buffer = new byte[1] { 42 };
const int ExpectedErrorCode = 0xfffffff;

await RunBidirectionalClientServer(
async clientStream =>
{
await sem.WaitAsync();
},
async serverStream =>
QuicStream clientStream = clientConnection.OpenBidirectionalStream();
Task<QuicStream> t = serverConnection.AcceptStreamAsync().AsTask();
await TaskTimeoutExtensions.WhenAllOrAnyFailed(clientStream.WriteAsync(buffer).AsTask(), t, PassingTestTimeoutMilliseconds);
QuicStream serverStream = t.Result;
Assert.Equal(1, await serverStream.ReadAsync(buffer));

// streams are new established and in good shape.
using (clientStream)
using (serverStream)
{
Task exTask = Assert.ThrowsAsync<QuicOperationAbortedException>(() => serverStream.ReadAsync(new byte[1]).AsTask());

Assert.False(exTask.IsCompleted);

serverStream.AbortRead(ExpectedErrorCode);

await exTask;

sem.Release();
});
}
}
}

[Fact]
Expand Down