Example #1
0
        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}");
            }
        }
Example #2
0
 public void Stop()
 {
     _receiveLogsAction.Cancel();
     _ringLogger.Stop();
 }
Example #3
0
 public void Stop()
 {
     _updateBytesTransferredAction.Cancel();
 }