private void ProcessSessionTermination(SessionTerminationEvent @event)
        {
            SessionTerminated?.Invoke(@event);

            string      sessionId = @event.SessionId;
            VaspSession vaspSession;

            if (!_beneficiarySessionsDict.TryGetValue(sessionId, out var benSession))
            {
                if (!_originatorSessionsDict.TryGetValue(sessionId, out var origSession))
                {
                    return;
                }

                vaspSession = origSession;
                _originatorSessionsDict.TryRemove(sessionId, out _);
            }
            else
            {
                _beneficiarySessionsDict.TryRemove(sessionId, out _);
                vaspSession = benSession;
            }

            //TODO: Work on session life cycle
            try
            {
                vaspSession.Dispose();
            }
            finally
            {
            }
        }
示例#2
0
        public void RemoveSession(ConnectionSessionId sessionId)
        {
            lock (currentSessions)
            {
                var sessionToRemove = GetSessionInfo(sessionId);
                currentSessions.Remove(sessionId);

                SessionTerminated?.Invoke(sessionToRemove);
            }
        }
示例#3
0
        private void OnCommunicationService_SessionTerminated(object sender, SessionEventArgs e)
        {
            try
            {
                CheckSessionTerminatedActions(e.Session, e.SessionContract);

                SessionTerminated?.Invoke(e.SessionContract, e);

                sessionIdContractMapping.Remove(e.Session.SessionId);
            }
            catch (Exception ex)
            {
                if (logger != null)
                {
                    logger.Error(ex.ToString());
                }
                else
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }