Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private Task<int> ValidateState(CancellationToken cancellationToken)
case FrameStreamState.Open:
if (cancellationToken.IsCancellationRequested)
{
return TaskUtilities.GetCancelledZeroTask();
return TaskUtilities.GetCancelledZeroTask(cancellationToken);
}
break;
case FrameStreamState.Closed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ public static Task GetCancelledTask(CancellationToken cancellationToken)
#endif
}

public static Task<int> GetCancelledZeroTask()
public static Task<int> GetCancelledZeroTask(CancellationToken cancellationToken = default(CancellationToken))
{
// Task<int>.FromCanceled doesn't return Task<int>
#if NETSTANDARD1_3
return Task.FromCanceled<int>(cancellationToken);
#else
var tcs = new TaskCompletionSource<int>();
tcs.TrySetCanceled();
return tcs.Task;
#endif
}
}
}