Exemplo n.º 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());
                }
            }
        }
Exemplo n.º 2
0
        public void reachedAlive(ConnectionStateEnum oldStateBeneath, I_XmlBlasterAccess connection)
        {
            ConnectionStateEnum oldState = this.currentState;

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

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