Skip to content

Commit

Permalink
Add ConfigureAwait(false) to various place
Browse files Browse the repository at this point in the history
  • Loading branch information
liveans committed May 26, 2024
1 parent 35e4aad commit b35b727
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ private async Task<Http3LoopbackConnection> EstablishHttp3ConnectionAsync(params
QuicConnection con = await _listener.AcceptConnectionAsync().ConfigureAwait(false);
Http3LoopbackConnection connection = new Http3LoopbackConnection(con);

await connection.EstablishControlStreamAsync(settingsEntries);
await connection.EstablishControlStreamAsync(settingsEntries).ConfigureAwait(false);
return connection;
}

public override async Task<GenericLoopbackConnection> EstablishGenericConnectionAsync()
{
return await EstablishHttp3ConnectionAsync();
return await EstablishHttp3ConnectionAsync().ConfigureAwait(false);
}

public Task<Http3LoopbackConnection> EstablishConnectionAsync(params SettingsEntry[] settingsEntries)
Expand All @@ -89,12 +89,12 @@ public override async Task AcceptConnectionAsync(Func<GenericLoopbackConnection,
{
await using Http3LoopbackConnection con = await EstablishHttp3ConnectionAsync().ConfigureAwait(false);
await funcAsync(con).ConfigureAwait(false);
await con.ShutdownAsync();
await con.ShutdownAsync().ConfigureAwait(false);
}

public override async Task<HttpRequestData> HandleRequestAsync(HttpStatusCode statusCode = HttpStatusCode.OK, IList<HttpHeaderData> headers = null, string content = "")
{
await using Http3LoopbackConnection con = (Http3LoopbackConnection)await EstablishGenericConnectionAsync().ConfigureAwait(false);
await using Http3LoopbackConnection con = await EstablishHttp3ConnectionAsync().ConfigureAwait(false);
return await con.HandleRequestAsync(statusCode, headers, content).ConfigureAwait(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -999,11 +999,6 @@ await connection.WriteStringAsync(
[ActiveIssue("https://github.com/dotnet/runtime/issues/65429", typeof(PlatformDetection), nameof(PlatformDetection.IsNodeJS))]
public async Task ReadAsStreamAsync_HandlerProducesWellBehavedResponseStream(bool? chunked, bool enableWasmStreaming, bool slowChunks)
{
if (UseVersion == HttpVersion30)
{
throw new SkipTestException("https://github.com/dotnet/runtime/issues/91757");
}

if (IsWinHttpHandler && UseVersion >= HttpVersion20.Value)
{
return;
Expand Down Expand Up @@ -1036,11 +1031,11 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
}
using (var client = new HttpMessageInvoker(CreateHttpClientHandler()))
using (HttpResponseMessage response = await client.SendAsync(TestAsync, request, CancellationToken.None))
using (HttpResponseMessage response = await client.SendAsync(TestAsync, request, CancellationToken.None).ConfigureAwait(false))
{
using (Stream responseStream = await response.Content.ReadAsStreamAsync(TestAsync))
using (Stream responseStream = await response.Content.ReadAsStreamAsync(TestAsync).ConfigureAwait(false))
{
Assert.Same(responseStream, await response.Content.ReadAsStreamAsync(TestAsync));
Assert.Same(responseStream, await response.Content.ReadAsStreamAsync(TestAsync).ConfigureAwait(false));
// Boolean properties returning correct values
Assert.True(responseStream.CanRead);
Expand Down Expand Up @@ -1255,8 +1250,8 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async uri =>
{
var request = new HttpRequestMessage(HttpMethod.Get, uri) { Version = UseVersion };
using (HttpResponseMessage response = await client.SendAsync(TestAsync, request, CancellationToken.None))
using (Stream responseStream = await response.Content.ReadAsStreamAsync(TestAsync))
using (HttpResponseMessage response = await client.SendAsync(TestAsync, request, CancellationToken.None).ConfigureAwait(false))
using (Stream responseStream = await response.Content.ReadAsStreamAsync(TestAsync).ConfigureAwait(false))
{
// Boolean properties returning correct values
Assert.True(responseStream.CanRead);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1635,8 +1635,6 @@ public SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLength_Http2(ITest

[Collection(nameof(DisableParallelization))]
[ConditionalClass(typeof(HttpClientHandlerTestBase), nameof(IsQuicSupported))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/91757")]
[ActiveIssue("https://github.com/dotnet/runtime/issues/101015")]
public sealed class SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLength_Http3 : SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLength
{
public SocketsHttpHandler_HttpClientHandler_MaxResponseHeadersLength_Http3(ITestOutputHelper output) : base(output) { }
Expand Down

0 comments on commit b35b727

Please sign in to comment.