예제 #1
0
 public void Logout(SessionId sessionId)
 {
     if (sessionId != null)
     {
         try
         {
             _Sync.AcquireWriterLock(Timeout.Infinite);
             if (_AuthorizedUsers.ContainsKey(sessionId.Id))
             {
                 _AuthorizedUsers.Remove(sessionId.Id);
             }
             //CallContext.FreeNamedDataSlot("id");
             // session may be already destroyed here(?)
             try
             {
                 GenuineUtility.CurrentSession["id"] = null;
             }
             catch
             {
             }
         }
         finally
         {
             _Sync.ReleaseWriterLock();
         }
     }
 }
예제 #2
0
 public User GetUser(SessionId sessionId)
 {
     if (sessionId != null)
     {
         try
         {
             _Sync.AcquireReaderLock(Timeout.Infinite);
             UserItem ui;
             if (_AuthorizedUsers.TryGetValue(sessionId.Id, out ui))
             {
                 return ui.User;
             }
             else
             {
                 return null;
             }
         }
         finally
         {
             _Sync.ReleaseReaderLock();
         }
     }
     return null;
 }