DecreaseSessionCount() public static method

public static DecreaseSessionCount ( Protocol protocol ) : void
protocol Protocol
return void
Exemplo n.º 1
0
        /// <summary>
        /// When session has completed, log any error which occured and dispose resources. This is done asynchronously
        /// sincew we want to be able to start new session without previous to complete.
        /// </summary>
        private void HandleSessionAsynchronously(Task sessionTask, Connection connection, ISession session)
        {
            sessionTask.ContinueWith(f =>
            {
                if (f.IsFaulted)
                {
                    var exception = f.Exception.InnerException;

                    _log.LogException(new LogEvent()
                    {
                        LogLevel       = LogLevel.Error,
                        EventType      = LogEventType.Application,
                        Message        = exception.Message,
                        RemoteEndpoint = connection.RemoteEndpoint,
                        SessionId      = connection.SessionId,
                        Protocol       = session.Protocol.ToString()
                    }, exception);
                }

                SessionManager.DecreaseSessionCount(session.Protocol);

                // Session has ended.
                connection.Dispose();
            });
        }