private async Task CancelVpnConnectionAndWait(Task connectTask) { try { _logger.Info($"OpenVpnConnection: Cancelling Connection task"); _connectAction.Cancel(); _logger.Info($"OpenVpnConnection: Waiting for Connection task to finish..."); if (await Task.WhenAny(connectTask, Task.Delay(WaitForConnectionTaskToFinishAfterCancellation)) != connectTask) { _logger.Warn($"OpenVpnConnection: Connection task has not finished in {WaitForConnectionTaskToFinishAfterCancellation}"); } } catch (Exception ex) when(IsImplementationException(ex)) { _logger.Error($"OpenVpnConnection: Connection task failed: {ex}"); } }
public void Stop() { _receiveLogsAction.Cancel(); _ringLogger.Stop(); }
public void Stop() { _updateBytesTransferredAction.Cancel(); }