Skip to content

Commit

Permalink
[release/8.0] Fix Dispose and SendData Race on Http3 Test (#91690)
Browse files Browse the repository at this point in the history
* Fix Dispose and Send Data Race

* Review feedback

---------

Co-authored-by: Ahmet Ibrahim Aksoy (from Dev Box) <[email protected]>
  • Loading branch information
github-actions[bot] and liveans committed Sep 11, 2023
1 parent acab656 commit 64c5aae
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,7 @@ public async Task DuplexStreaming_AbortByServer_StreamingCancelled(bool graceful
public async Task ServerSendsTrailingHeaders_Success()
{
using Http3LoopbackServer server = CreateHttp3LoopbackServer();
SemaphoreSlim clientFinishedSemaphore = new SemaphoreSlim(0);

Task serverTask = Task.Run(async () =>
{
Expand All @@ -1636,6 +1637,7 @@ public async Task ServerSendsTrailingHeaders_Success()
await requestStream.ReadRequestDataAsync();
await requestStream.SendResponseAsync(isFinal: false);
await requestStream.SendResponseHeadersAsync(null, new[] { new HttpHeaderData("MyHeader", "MyValue") });
await clientFinishedSemaphore.WaitAsync(TimeSpan.FromSeconds(20));
});

Task clientTask = Task.Run(async () =>
Expand All @@ -1655,6 +1657,7 @@ public async Task ServerSendsTrailingHeaders_Success()
(string key, IEnumerable<string> value) = Assert.Single(response.TrailingHeaders);
Assert.Equal("MyHeader", key);
Assert.Equal("MyValue", Assert.Single(value));
clientFinishedSemaphore.Release();
});

await new[] { clientTask, serverTask }.WhenAllOrAnyFailed(200_000);
Expand Down

0 comments on commit 64c5aae

Please sign in to comment.