Propagate cancellation token IAsyncEnumerators (#10901)
This commit is contained in:
parent
e18f18b0af
commit
61e689471f
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue