public override void Stop() { _logger.Log(LogLevel.Information, $"Stopping {Connection.name}"); Connection.started = false; try { if (dicomClient != null) { dicomClient.ReleaseAsync(); dicomClient.AbortAsync(); } } catch (Exception e) { _logger.LogFullException(e); } try { foreach (var server in dicomListeners) { server.Stop(); server.Dispose(); } dicomListeners.Clear(); } catch (Exception e) { _logger.LogFullException(e); } }
static async Task AbortTask(DicomClient client, CancellationToken token, int id) { Console.WriteLine($"Abort running... {id}"); await Task.Delay(1); token.WaitHandle.WaitOne(); await client.AbortAsync(); await client.ReleaseAsync(); Console.WriteLine($"Client abort {id}"); }