예제 #1
0
        public void BeginSession(ServerSessionBase session)
        {
            pool.Add(session);

            session.ReleaseEvent += Session_OnReleased;
            OnSessionStarted(session);
        }
예제 #2
0
        public bool Authorize(HttpListenerResponse response, HttpUserCredentials user)
        {
            if (!Restricted)
            {
                return(true);
            }

            var _user = Authorization.Authorize(user);

            if (_user == null)
            {
                return(false);
            }

            _user.Lifespan = TimeSpan.FromMinutes(60);
            _user.Restart();

            userTokens.Add(_user);

            var cookie = new Cookie(CookieName, _user.SessionId)
            {
                Expires = DateTime.Now.AddYears(1),
            };

            response.SetCookie(cookie);

            return(true);
        }
예제 #3
0
        public void BeginSession(AgentSessionBase session)
        {
            pool.Add(session);

            session.ReleaseEvent += Session_OnReleased;
            OnSessionChanged(session);

            Log.Info($"Started Session '{session.SessionId}'.");
        }
예제 #4
0
 /// <summary>
 /// 向引用池中追加指定数量的引用
 /// </summary>
 /// <param name="referenceType">引用类型</param>
 /// <param name="count">追加数量</param>
 public void Add(Type referenceType, int count)
 {
     ReferencePool.Add(referenceType, count);
 }
예제 #5
0
 /// <summary>
 /// 向引用池中追加指定数量的引用
 /// </summary>
 /// <typeparam name="T">引用类型</typeparam>
 /// <param name="count">追加数量</param>
 public void Add <T>(int count) where T : class, IReference, new()
 {
     ReferencePool.Add <T>(count);
 }
예제 #6
0
 public void Add(TaskRunner runner)
 {
     pool.Add(runner);
 }
예제 #7
0
 public void BeginSession(IAgentSession session)
 {
     pool.Add(session);
     Log.Info($"Started Session '{session.SessionId}'.");
 }