Ejemplo n.º 1
0
        public async Task ReconnectAsync(Server lastServer, Profile lastProfile, VpnReconnectionSettings settings = null)
        {
            settings ??= new VpnReconnectionSettings();

            if (!settings.IsToReconnectIfDisconnected && IsDisconnected())
            {
                _logger.Info("Reconnection refused because it is disconnected.");
                ResetReconnectionStep();
                return;
            }

            if (_appSettings.IsSmartReconnectEnabled() || settings.IsToForceSmartReconnect || HasSecureCoreChanged(lastProfile, lastServer))
            {
                await SmartReconnectAsync(lastServer, lastProfile, settings);
            }
            else
            {
                await NonSmartReconnectAsync(lastServer, lastProfile);
            }
        }
Ejemplo n.º 2
0
 public async Task ReconnectAsync(VpnReconnectionSettings settings = null)
 {
     await Enqueue(() => _vpnReconnector.ReconnectAsync(
                       _vpnConnector.LastServer, _vpnConnector.LastProfile, settings));
 }
Ejemplo n.º 3
0
        private async Task SmartReconnectAsync(Server lastServer, Profile lastProfile, VpnReconnectionSettings settings)
        {
            _isToShowReconnectionPopup = settings.IsToShowReconnectionPopup;
            VpnReconnectionSteps reconnectionStep = _reconnectionStep;

            SetTargetServerAndProfile(lastServer, lastProfile, reconnectionStep);
            reconnectionStep = IncrementReconnectionStep(reconnectionStep);
            await ExecuteReconnectionAsync(reconnectionStep, isToTryLastServer : !settings.IsToExcludeLastServer);

            if (reconnectionStep == VpnReconnectionSteps.Disconnect)
            {
                ResetReconnectionStep();
            }
            else
            {
                _reconnectionStep = reconnectionStep;
            }
        }