Propagate cancellation token IAsyncEnumerators (#10901)

This commit is contained in:
Mikael Mengistu 2019-06-05 13:06:36 -07:00 committed by GitHub
parent e18f18b0af
commit 61e689471f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -1944,7 +1944,7 @@ namespace Microsoft.AspNetCore.SignalR.Client
public async Task<ConnectionState> WaitForActiveConnectionAsync(string methodName, [CallerMemberName] string memberName = null, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = 0)
{
await WaitConnectionLockAsync();
await WaitConnectionLockAsync(methodName);
if (CurrentConnectionStateUnsynchronized == null || CurrentConnectionStateUnsynchronized.Stopping)
{

View File

@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal
public IAsyncEnumerator<TResult> GetAsyncEnumerator(CancellationToken cancellationToken = default)
{
var enumerator = _asyncEnumerable.GetAsyncEnumerator();
var enumerator = _asyncEnumerable.GetAsyncEnumerator(_cts.Token);
if (cancellationToken.CanBeCanceled)
{
var registration = cancellationToken.Register((ctsState) =>
@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal
((CancellationTokenSource)ctsState).Cancel();
}, _cts);
return new CancelableEnumerator<TResult>(_asyncEnumerable.GetAsyncEnumerator(), registration);
return new CancelableEnumerator<TResult>(enumerator, registration);
}
return enumerator;