/// <summary>
        /// Raises an event related to a session.
        /// </summary>
        protected virtual void RaiseSessionEvent(Session session, SessionEventReason reason)
        {
            lock (m_eventLock)
            {
                SessionEventHandler handler = null;

                switch (reason)
                {
                case SessionEventReason.Created: { handler = m_SessionCreated; break; }

                case SessionEventReason.Activated: { handler = m_SessionActivated; break; }

                case SessionEventReason.Closing: { handler = m_SessionClosing; break; }
                }

                if (handler != null)
                {
                    try
                    {
                        handler(session, reason);
                    }
                    catch (Exception e)
                    {
                        Utils.Trace(e, "Session event handler raised an exception.");
                    }
                }
            }
        }
Example #2
0
        private static void OnSessionClosing(Session session, SessionEventReason reason)
        {
            string   sessionId   = $"ns = {session.Id.NamespaceIndex}; i = {session.Id.Identifier} ";
            string   name        = session.SessionDiagnostics.SessionName;
            string   user        = session.Identity.DisplayName;
            DateTime lastContact = session.SessionDiagnostics.ClientLastContactTime;

            Console.WriteLine("***************** Session Closed ********************************");
            Console.WriteLine("SessionId: " + sessionId);
            Console.WriteLine("Name: " + name);
            Console.WriteLine("User: "******"LastContact: " + lastContact);
            Console.WriteLine("*****************************************************************");
        }
Example #3
0
 /// <summary>
 /// Handle session event by logging status
 /// </summary>
 /// <param name="session"></param>
 /// <param name="reason"></param>
 private void OnEvent(Session session, SessionEventReason reason)
 {
     _lastEventTime = DateTime.UtcNow;
     LogSessionStatus(session, reason.ToString());
 }
Example #4
0
 /// <summary>
 /// Handler for server status changes.
 /// </summary>
 private static void ServerEventStatus(Session session, SessionEventReason reason)
 {
     PrintSessionStatus(session, reason.ToString());
 }
 private void EventStatus(Session session, SessionEventReason reason)
 {
     lastEventTime = DateTime.UtcNow;
     PrintSessionStatus(session, reason.ToString());
 }
Example #6
0
        /// <summary>
        /// Handler for server status changes.
        /// </summary>

        private static void ServerEventStatus(Session session, SessionEventReason reason)
        {
            _lastServerSessionEventTime = DateTime.UtcNow;
            PrintSessionStatus(session, reason.ToString());
        }
Example #7
0
 /// <summary>
 /// Logs the session event.
 /// </summary>
 private void SessionManager_SessionEvent(Session session, SessionEventReason reason)
 {
     dsLog.WriteAction("{0} {1}", session.SessionDiagnostics.SessionName, reason.ToString().ToLowerInvariant());
 }
        /// <summary>
        /// Raises an event related to a session.
        /// </summary>
        protected virtual void RaiseSessionEvent(Session session, SessionEventReason reason)
        { 
            lock (m_eventLock)
            {
                SessionEventHandler handler = null;

                switch (reason)
                {
                    case SessionEventReason.Created:   { handler = m_SessionCreated;   break; }
                    case SessionEventReason.Activated: { handler = m_SessionActivated; break; }
                    case SessionEventReason.Closing:   { handler = m_SessionClosing;   break; }
                }

                if (handler != null)
                {
                    try
                    {
                        handler(session, reason);
                    }
                    catch (Exception e)
                    {
                        Utils.Trace(e, "Session event handler raised an exception.");
                    }
                }
            } 
        }
 private void EventStatus(Session session, SessionEventReason reason)
 {
     lastEventTime = DateTime.UtcNow;
     PrintSessionStatus(session, reason.ToString());
 }