Exemplo n.º 1
0
 public void Dispose()
 {
     _aborted?.Dispose();
     _aborted = null;
     _timer?.Dispose();
     _timer = null;
 }
Exemplo n.º 2
0
        private async Task StopAsync(bool cancel, TimeSpan?delay)
        {
            _timer.Dispose();
            _timer = null;
            if (cancel)
            {
                if (delay > TimeSpan.Zero)
                {
                    _aborted.CancelAfter(delay.Value);
                }
                else
                {
                    _aborted.Cancel();
                }
            }

            await Task.WhenAll(_warps.Select(s => s.Task));

            await _transport.Flush();
        }