コード例 #1
0
        private void callStateListener(ConnectionStateEnum oldState, ConnectionStateEnum newState)
        {
            if (oldState == newState)
            {
                OnLogging(XmlBlasterLogLevel.WARN, "XmlBlasterAccess", "Same states in transition: " + newState);
                return;
            }

            I_ConnectionStateListener l = this.connectionStateListener;

            if (l != null)
            {
                try
                {
                    if (newState == ConnectionStateEnum.ALIVE)
                    {
                        l.reachedAlive(oldState, this);
                    }
                    else if (newState == ConnectionStateEnum.POLLING)
                    {
                        l.reachedPolling(oldState, this);
                    }
                    else if (newState == ConnectionStateEnum.DEAD)
                    {
                        l.reachedDead(oldState, this);
                    }
                }
                catch (Exception e)
                {
                    OnLogging(XmlBlasterLogLevel.WARN, "" + newState, "User code failed: " + e.ToString());
                }
            }
        }
コード例 #2
0
        public void reachedPolling(ConnectionStateEnum oldStateBeneath, I_XmlBlasterAccess connection)
        {
            ConnectionStateEnum oldState = this.currentState;

            this.currentState = ConnectionStateEnum.POLLING;
            I_ConnectionStateListener l = this.connectionStateListener;

            if (l != null)
            {
                try
                {
                    l.reachedPolling(oldState, connection);
                }
                catch (Exception e)
                {
                    OnLogging(XmlBlasterLogLevel.WARN, "reachedPolling", "User code failed: " + e.ToString());
                }
            }
            StopPinging();
            StartPolling();
        }