コード例 #1
0
        /// <summary>
        /// Handles commands when in the Recovering state.
        /// </summary>
        /// <param name="command"></param>
        private void RecoveryLoopRecoveringHandler(RecoveryCommand command)
        {
            switch (command)
            {
            case RecoveryCommand.BeginAutomaticRecovery:
                ESLog.Info("Received request to BeginAutomaticRecovery, but already in Recovering state.");
                break;

            case RecoveryCommand.PerformAutomaticRecovery:
                if (TryPerformAutomaticRecovery())
                {
                    m_recoveryLoopState = RecoveryConnectionState.Connected;
                }
                else
                {
                    Task.Delay(m_factory.NetworkRecoveryInterval).ContinueWith(t => { m_recoveryLoopCommandQueue.TryAdd(RecoveryCommand.PerformAutomaticRecovery); });
                }

                break;

            default:
                ESLog.Warn($"RecoveryLoop command {command} is out of range.");
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Handles commands when in the Recovering state.
        /// </summary>
        /// <param name="command"></param>
        private void RecoveryLoopRecoveringHandler(RecoveryCommand command)
        {
            switch (command)
            {
            case RecoveryCommand.BeginAutomaticRecovery:
                ESLog.Info("Received request to BeginAutomaticRecovery, but already in Recovering state.");
                break;

            case RecoveryCommand.PerformAutomaticRecovery:
                if (TryPerformAutomaticRecovery())
                {
                    _recoveryLoopState = RecoveryConnectionState.Connected;
                }
                else
                {
                    ScheduleRecoveryRetry();
                }

                break;

            default:
                ESLog.Warn($"RecoveryLoop command {command} is out of range.");
                break;
            }
        }
コード例 #3
0
        /// <summary>
        /// Handles commands when in the Recovering state.
        /// </summary>
        /// <param name="command"></param>
        private async Task RecoveryLoopRecoveringHandler(RecoveryCommand command)
        {
            switch (command)
            {
            case RecoveryCommand.BeginAutomaticRecovery:
                ESLog.Info("Received request to BeginAutomaticRecovery, but already in Recovering state.");
                break;

            case RecoveryCommand.PerformAutomaticRecovery:
                if (TryPerformAutomaticRecovery())
                {
                    _recoveryLoopState = RecoveryConnectionState.Connected;
                }
                else
                {
                    await Task.Delay(_factory.NetworkRecoveryInterval);

                    _recoveryLoopCommandQueue.Enqueue(RecoveryCommand.PerformAutomaticRecovery);
                    _semaphore.Release();
                }

                break;

            default:
                ESLog.Warn($"RecoveryLoop command {command} is out of range.");
                break;
            }
        }
コード例 #4
0
        /// <summary>
        /// Handles commands when in the Connected state.
        /// </summary>
        /// <param name="command"></param>
        private void RecoveryLoopConnectedHandler(RecoveryCommand command)
        {
            switch (command)
            {
            case RecoveryCommand.PerformAutomaticRecovery:
                ESLog.Warn("Not expecting PerformAutomaticRecovery commands while in the connected state.");
                break;

            case RecoveryCommand.BeginAutomaticRecovery:
                m_recoveryLoopState = RecoveryConnectionState.Recovering;
                Task.Delay(m_factory.NetworkRecoveryInterval).ContinueWith(t => { m_recoveryLoopCommandQueue.TryAdd(RecoveryCommand.PerformAutomaticRecovery); });
                break;

            default:
                ESLog.Warn($"RecoveryLoop command {command} is out of range.");
                break;
            }
        }
コード例 #5
0
        /// <summary>
        /// Handles commands when in the Connected state.
        /// </summary>
        /// <param name="command"></param>
        private void RecoveryLoopConnectedHandler(RecoveryCommand command)
        {
            switch (command)
            {
            case RecoveryCommand.PerformAutomaticRecovery:
                ESLog.Warn("Not expecting PerformAutomaticRecovery commands while in the connected state.");
                break;

            case RecoveryCommand.BeginAutomaticRecovery:
                _recoveryLoopState = RecoveryConnectionState.Recovering;
                ScheduleRecoveryRetry();
                break;

            default:
                ESLog.Warn($"RecoveryLoop command {command} is out of range.");
                break;
            }
        }
コード例 #6
0
        /// <summary>
        /// Handles commands when in the Connected state.
        /// </summary>
        /// <param name="command"></param>
        private async Task RecoveryLoopConnectedHandler(RecoveryCommand command)
        {
            switch (command)
            {
            case RecoveryCommand.PerformAutomaticRecovery:
                ESLog.Warn("Not expecting PerformAutomaticRecovery commands while in the connected state.");
                break;

            case RecoveryCommand.BeginAutomaticRecovery:
                _recoveryLoopState = RecoveryConnectionState.Recovering;
                await Task.Delay(_factory.NetworkRecoveryInterval).ConfigureAwait(false);

                _recoveryLoopCommandQueue.TryAdd(RecoveryCommand.PerformAutomaticRecovery);
                break;

            default:
                ESLog.Warn($"RecoveryLoop command {command} is out of range.");
                break;
            }
        }