Skip to content
Open
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
4 changes: 4 additions & 0 deletions NBitcoin/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ public static IEnumerable<List<T>> Partition<T>(this IEnumerable<T> source, Func
//Only take the slow path if cancellation is possible.
if (stream is NetworkStream && cancellation.CanBeCanceled)
{
#if !NO_SOCKETASYNC
currentReadCount = stream.ReadAsync(buffer, offset + totalReadCount, count - totalReadCount, cancellation).GetAwaiter().GetResult();
#else
var ar = stream.BeginRead(buffer, offset + totalReadCount, count - totalReadCount, null, null);
if (!ar.CompletedSynchronously)
{
Expand All @@ -338,6 +341,7 @@ public static IEnumerable<List<T>> Partition<T>(this IEnumerable<T> source, Func
cancellation.ThrowIfCancellationRequested();

currentReadCount = stream.EndRead(ar);
#endif
}
else
{
Expand Down