Пример #1
0
        public bool AddAndCheck(Session session, double cost)
        {
            lock (_delays)
            {
                double delay;
                if (!_delays.TryGetValue(session.Address, out delay))
                {
                    if (cost > 0)
                        _delays.Add(session.Address, cost);
                }
                else
                {
                    _delays[session.Address] += cost;
                }

                var shouldDelay = (delay + cost) >= DelayThreshold;

                if (shouldDelay)
                    session.SendSysMessage("Too many requests are coming from your location and your request has been canceled. Please wait and try again in a few minutes.");

                return shouldDelay;
            }
        }
Пример #2
0
 public CommandTarget(Session session)
 {
     Room = Program.RoomManager.Get(session.Room);
     Session = session;
 }
Пример #3
0
 public abstract void Handle(Session session);
Пример #4
0
 public bool Check(Session session)
 {
     return AddAndCheck(session, 0);
 }