Ejemplo n.º 1
0
 /// <summary>
 /// Does an early check to see if this queue empty callback is already
 /// running, then asynchronously firing the event
 /// </summary>
 /// <param name="throttleIndex">Throttle category to fire the callback
 /// for</param>
 private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories)
 {
     if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty)
     {
         // Use a value of 0 to signal that FireQueueEmpty is running
         m_nextOnQueueEmpty = 0;
         // Asynchronously run the callback
         Util.FireAndForget(FireQueueEmpty, categories);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Does an early check to see if this queue empty callback is already
        /// running, then asynchronously firing the event
        /// </summary>
        /// <param name="categories">Throttle categories to fire the callback for</param>
        private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories)
        {
//            if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty)
            if (!m_isQueueEmptyRunning && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty)
            {
                m_isQueueEmptyRunning = true;

                int start = Environment.TickCount & Int32.MaxValue;
                const int MIN_CALLBACK_MS = 30;

                m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;
                if (m_nextOnQueueEmpty == 0)
                    m_nextOnQueueEmpty = 1;

                // Use a value of 0 to signal that FireQueueEmpty is running
//                m_nextOnQueueEmpty = 0;

                m_categories = categories;

                if (HasUpdates(m_categories))
                {
                    if (!m_udpServer.OqrEngine.IsRunning)
                    {
                        // Asynchronously run the callback
                        Util.FireAndForget(FireQueueEmpty, categories, "LLUDPClient.BeginFireQueueEmpty");
                    }
                    else
                    {
                        m_udpServer.OqrEngine.QueueJob(AgentID.ToString(), () => FireQueueEmpty(categories));
                    }
                }
                else
                {
                    m_isQueueEmptyRunning = false;
                }
            }
        }
        public bool QueueRequest(LLUDPClient client, ThrottleOutPacketTypeFlags categories)
        {
            if (m_requestQueue.Count < m_requestQueue.BoundedCapacity)
            {
//                m_log.DebugFormat(
//                    "[OUTGOING QUEUE REFILL ENGINE]: Adding request for categories {0} for {1} in {2}", 
//                    categories, client.AgentID, m_udpServer.Scene.Name);

                m_requestQueue.Add(new RefillRequest(client, categories));

                if (!m_warnOverMaxQueue)
                    m_warnOverMaxQueue = true;

                return true;
            }
            else
            {
                if (m_warnOverMaxQueue)
                {
                    m_log.WarnFormat(
                        "[OUTGOING QUEUE REFILL ENGINE]: Request queue at maximum capacity, not recording request from {0} in {1}", 
                        client.AgentID, m_udpServer.Scene.Name);

                    m_warnOverMaxQueue = false;
                }

                return false;
            }
        }
 public RefillRequest(LLUDPClient client, ThrottleOutPacketTypeFlags categories)
 {
     Client = client;
     Categories = categories;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Does an early check to see if this queue empty callback is already
        /// running, then asynchronously firing the event
        /// </summary>
        /// <param name="categories">Throttle categories to fire the callback for</param>
        private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories)
        {
            int start = Environment.TickCount;
            if (!m_isQueueEmptyRunning && start - m_nextOnQueueEmpty >= 0)
            {
                m_isQueueEmptyRunning = true;

                const int MIN_CALLBACK_MS = 30;

                m_nextOnQueueEmpty = start + MIN_CALLBACK_MS;

                m_categories = categories;

                if (HasUpdates(m_categories))
                {
                    // Asynchronously run the callback
                    Util.FireAndForget(FireQueueEmpty, categories);
                }
                else
                {
                    m_isQueueEmptyRunning = false;
                }
            }
        }