Improvement of transport creation handler: cancellation/timeouts, chain of responsibility for other types of transport
benrr101 opened this issue · comments
PR #2607
I have a simple enough TimedCancellationToken
class which might help to handle cancellations and timeouts properly (and to time the end-to-end operation more precisely - using Stopwatches rather than DateTimes.) The initial API shape is
public sealed class TimedCancellationToken : IDisposable
{
public TimeSpan ElapsedTime { get; }
public TimeSpan RemainingTime { get; }
public TimeSpan TimeoutPeriod { get; }
public CancellationToken Token { get; }
public TimedCancellationToken(TimeSpan timeout, CancellationToken userCancellationToken) { }
public void Start() { }
public void ThrowIfCancellationRequestedOrTimedOut(out bool userCancellationRequested) { }
public void Dispose() { }
}
Is this needed? If so, which PR would it be most useful in?