Skip to content

Commit

Permalink
Sync shared code from runtime (#20126)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] authored Mar 25, 2020
1 parent 9cc14db commit 76add62
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal override IPEndPoint LocalEndPoint

internal async ValueTask SetSecurityConfigForConnection(X509Certificate cert, string? certFilePath, string? privateKeyFilePath)
{
_securityConfig = await MsQuicApi.Api.CreateSecurityConfig(cert, certFilePath, privateKeyFilePath);
_securityConfig = await MsQuicApi.Api.CreateSecurityConfig(cert, certFilePath, privateKeyFilePath).ConfigureAwait(false);
// TODO this isn't being set correctly
MsQuicParameterHelpers.SetSecurityConfig(MsQuicApi.Api, _ptr, (uint)QUIC_PARAM_LEVEL.CONNECTION, (uint)QUIC_PARAM_CONN.SEC_CONFIG, _securityConfig!.NativeObjPtr);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal override async ValueTask<QuicConnectionProvider> AcceptConnectionAsync(

await connection.SetSecurityConfigForConnection(_sslOptions.ServerCertificate!,
_options.CertificateFilePath,
_options.PrivateKeyFilePath);
_options.PrivateKeyFilePath).ConfigureAwait(false);

if (NetEventSource.IsEnabled) NetEventSource.Exit(this);
return connection;
Expand Down
16 changes: 8 additions & 8 deletions src/Shared/runtime/Quic/Implementations/MsQuic/MsQuicStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ internal override async ValueTask WriteAsync(ReadOnlySequence<byte> buffers, boo

ThrowIfDisposed();

using CancellationTokenRegistration registration = await HandleWriteStartState(cancellationToken);
using CancellationTokenRegistration registration = await HandleWriteStartState(cancellationToken).ConfigureAwait(false);

await SendReadOnlySequenceAsync(buffers, endStream ? QUIC_SEND_FLAG.FIN : QUIC_SEND_FLAG.NONE);
await SendReadOnlySequenceAsync(buffers, endStream ? QUIC_SEND_FLAG.FIN : QUIC_SEND_FLAG.NONE).ConfigureAwait(false);

HandleWriteCompletedState();

Expand All @@ -149,9 +149,9 @@ internal override async ValueTask WriteAsync(ReadOnlyMemory<ReadOnlyMemory<byte>

ThrowIfDisposed();

using CancellationTokenRegistration registration = await HandleWriteStartState(cancellationToken);
using CancellationTokenRegistration registration = await HandleWriteStartState(cancellationToken).ConfigureAwait(false);

await SendReadOnlyMemoryListAsync(buffers, endStream ? QUIC_SEND_FLAG.FIN : QUIC_SEND_FLAG.NONE);
await SendReadOnlyMemoryListAsync(buffers, endStream ? QUIC_SEND_FLAG.FIN : QUIC_SEND_FLAG.NONE).ConfigureAwait(false);

HandleWriteCompletedState();

Expand All @@ -164,9 +164,9 @@ internal override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool e

ThrowIfDisposed();

using CancellationTokenRegistration registration = await HandleWriteStartState(cancellationToken);
using CancellationTokenRegistration registration = await HandleWriteStartState(cancellationToken).ConfigureAwait(false);

await SendReadOnlyMemoryAsync(buffer, endStream ? QUIC_SEND_FLAG.FIN : QUIC_SEND_FLAG.NONE);
await SendReadOnlyMemoryAsync(buffer, endStream ? QUIC_SEND_FLAG.FIN : QUIC_SEND_FLAG.NONE).ConfigureAwait(false);

HandleWriteCompletedState();

Expand Down Expand Up @@ -209,7 +209,7 @@ private async ValueTask<CancellationTokenRegistration> HandleWriteStartState(Can
// Make sure start has completed
if (!_started)
{
await _sendResettableCompletionSource.GetTypelessValueTask();
await _sendResettableCompletionSource.GetTypelessValueTask().ConfigureAwait(false);
_started = true;
}

Expand Down Expand Up @@ -277,7 +277,7 @@ internal override async ValueTask<int> ReadAsync(Memory<byte> destination, Cance
// TODO there could potentially be a perf gain by storing the buffer from the inital read
// This reduces the amount of async calls, however it makes it so MsQuic holds onto the buffers
// longer than it needs to. We will need to benchmark this.
int length = (int)await _receiveResettableCompletionSource.GetValueTask();
int length = (int)await _receiveResettableCompletionSource.GetValueTask().ConfigureAwait(false);

int actual = Math.Min(length, destination.Length);

Expand Down

0 comments on commit 76add62

Please sign in to comment.