Skip to content
Merged
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
9 changes: 6 additions & 3 deletions src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ async Task ReadChannelStream()
}
}

return CommonStreaming(connectionState, streamId, ReadChannelStream);
return CommonStreaming(connectionState, streamId, ReadChannelStream, tokenSource);
}

// this is called via reflection using the `_sendIAsyncStreamItemsMethod` field
Expand All @@ -760,11 +760,14 @@ async Task ReadAsyncEnumerableStream()
}
}

return CommonStreaming(connectionState, streamId, ReadAsyncEnumerableStream);
return CommonStreaming(connectionState, streamId, ReadAsyncEnumerableStream, tokenSource);
}

private async Task CommonStreaming(ConnectionState connectionState, string streamId, Func<Task> createAndConsumeStream)
private async Task CommonStreaming(ConnectionState connectionState, string streamId, Func<Task> createAndConsumeStream, CancellationTokenSource cts)
{
// make sure we dispose the CTS created by StreamAsyncCore once streaming completes
using var _ = cts;

Log.StartingStream(_logger, streamId);
string? responseError = null;
try
Expand Down