Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync shared code from runtime #20126

Merged
1 commit merged into from
Mar 25, 2020
Merged
Show file tree
Hide file tree
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 @@ -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