Skip disconnect on cancelled

Former-commit-id: db95448b14
This commit is contained in:
Malte Rosenbjerg 2020-12-06 00:34:50 +01:00
parent f3e55c9ae3
commit 0248d98877

View file

@ -42,12 +42,12 @@ public async Task During(CancellationToken cancellationToken = default)
{ {
await ProcessDataAsync(cancellationToken); await ProcessDataAsync(cancellationToken);
Debug.WriteLine($"Disconnecting NamedPipeServerStream on {GetType().Name}"); Debug.WriteLine($"Disconnecting NamedPipeServerStream on {GetType().Name}");
Pipe.Disconnect();
} }
catch (TaskCanceledException) catch (TaskCanceledException)
{ {
Debug.WriteLine($"ProcessDataAsync on {GetType().Name} cancelled"); Debug.WriteLine($"ProcessDataAsync on {GetType().Name} cancelled");
} }
Pipe.Disconnect();
} }
protected abstract Task ProcessDataAsync(CancellationToken token); protected abstract Task ProcessDataAsync(CancellationToken token);