Exemple #1
0
 private void QueueOverflow(object sender, ClientMonitoringQueue e)
 {
     lock (_accessLock)
     {
         var correspondingUser = _currentSessions.Keys.FirstOrDefault(u => u.UserName.Equals(e.GetUserName()));
         if (correspondingUser != null)
         {
             RemoveUserSession(correspondingUser);
         }
     }
 }
Exemple #2
0
        public void AddUserSession(User user)
        {
            lock (_accessLock)
            {
                //TODO: analyze the process, maybe will need to do nothing if the User queue already exists
                //if (_currentSessions.ContainsKey(user))
                //{
                //    _currentSessions[user].Clear();
                //    _currentSessions.Remove(user);
                //}

                if (!_currentSessions.ContainsKey(user))
                {
                    ClientMonitoringQueue queue = new ClientMonitoringQueue(user.UserName);
                    queue.QueueOverflow += QueueOverflow;
                    //queue.UserDisconnected += Queue_UserDisconnected;
                    _currentSessions[user] = queue;
                }
            }
        }