Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Minor fixes
  • Loading branch information
rzikm committed Apr 26, 2022
commit 253d09ec9f70820ab1f481a768751472f633e92f
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@ private static uint HandleEventConnectionClose(State state)

if (!state.StartCompletionSource.Task.IsCompleted)
{
state.StartCompletionSource.SetException(
state.StartCompletionSource.TrySetException(
ExceptionDispatchInfo.SetCurrentStackTrace(GetConnectionAbortedException(state)));
}

Expand Down Expand Up @@ -1676,12 +1676,18 @@ internal async ValueTask StartAsync(CancellationToken cancellationToken)
{
Debug.Assert(!Monitor.IsEntered(_state));

using var registration = cancellationToken.UnsafeRegister((state, token) => {
((State)state!).StartCompletionSource.SetCanceled(token);
using var registration = cancellationToken.UnsafeRegister((state, token) =>
{
((State)state!).StartCompletionSource.TrySetCanceled(token);
}, _state);

uint status = MsQuicApi.Api.StreamStartDelegate(_state.Handle, QUIC_STREAM_START_FLAGS.SHUTDOWN_ON_FAIL | QUIC_STREAM_START_FLAGS.INDICATE_PEER_ACCEPT);
QuicExceptionHelpers.ThrowIfFailed(status, "Could not start stream.");

if (!MsQuicStatusHelper.SuccessfulStatusCode(status))
{
_state.StartCompletionSource.TrySetException(QuicExceptionHelpers.CreateExceptionForHResult(status, "Could not start stream."));
throw QuicExceptionHelpers.CreateExceptionForHResult(status, "Could not start stream.");
}

await _state.StartCompletionSource.Task.ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ await RunClientServer(
// (CloseAsync may be processed before OpenStreamAsync as it is scheduled to the front of the operation queue)
// To be revisited once we standartize on exceptions.
// [ActiveIssue("https://github.com/dotnet/runtime/issues/55619")]
await Assert.ThrowsAsync<QuicOperationAbortedException>(() => connectTask);
await Assert.ThrowsAnyAsync<QuicException>(() => connectTask);

// Subsequent attempts should fail
// TODO: Should these be QuicOperationAbortedException, to match above? Or vice-versa?
Expand Down