示例#1
0
        protected override void OnStop()
        {
            try
            {
                _logger.Info("Service is stopping");
                LogEvent("Service is stopping");

                _vpnConnection.Disconnect();

                if (!_ipv6.Enabled)
                {
                    _ipv6.Enable();
                }

                foreach (var host in _hosts.ToList())
                {
                    _hosts.Remove(host);
                    host.Dispose();
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                LogEvent($"OnStop: {ex}");
                SentrySdk.WithScope(scope =>
                {
                    scope.Level = SentryLevel.Error;
                    scope.SetTag("captured_in", "Service_OnStop");
                    SentrySdk.CaptureException(ex);
                });
            }
        }
示例#2
0
        public void Disconnect(VpnError error)
        {
            _connectRequested     = false;
            _disconnectedReceived = false;

            _origin.Disconnect(error);
        }
示例#3
0
        public Task Disconnect(SettingsContract settings, VpnErrorTypeContract vpnError)
        {
            _logger.Info("Disconnect requested");

            _serviceSettings.Apply(settings);

            _vpnConnection.Disconnect(Map(vpnError));

            return(Task.CompletedTask);
        }
示例#4
0
 public void Disconnect(VpnError error)
 {
     _origin.Disconnect(error);
 }
示例#5
0
 public void Disconnect(VpnError error = VpnError.None)
 {
     _origin.Disconnect(error);
     RestoreNetworkSettings();
 }