/// <summary>
        /// Handle a fetch inventory request from the client
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="itemID"></param>
        /// <param name="ownerID"></param>
        public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID)
        {
//                m_log.DebugFormat(
//                    "[ASYNC INVENTORY SENDER]: Putting request from {0} for {1} on queue", remoteClient.Name, itemID);

            m_fetchHolder.Enqueue(new FetchHolder(remoteClient, itemID));

            if (!m_processing)
            {
                m_processing = true;
                ProcessQueue();
            }
        }
        /// <summary>
        /// Queue an outgoing packet if appropriate.
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="forceQueue">Always queue the packet if at all possible.</param>
        /// <returns>
        /// true if the packet has been queued,
        /// false if the packet has not been queued and should be sent immediately.
        /// </returns>
        public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue)
        {
            int category = (int)packet.Category;

            if (category >= 0 && category < m_packetOutboxes.Length)
            {
                ThreadedClasses.NonblockingQueue <OutgoingPacket> queue = m_packetOutboxes[category];
                TokenBucket bucket = m_throttleCategories[category];

                // Don't send this packet if there is already a packet waiting in the queue
                // even if we have the tokens to send it, tokens should go to the already
                // queued packets
                if (queue.Count > 0)
                {
                    queue.Enqueue(packet);
                    return(true);
                }


                if (!forceQueue && bucket.RemoveTokens(packet.Buffer.DataLength))
                {
                    // Enough tokens were removed from the bucket, the packet will not be queued
                    return(false);
                }
                else
                {
                    // Force queue specified or not enough tokens in the bucket, queue this packet
                    queue.Enqueue(packet);
                    return(true);
                }
            }
            else
            {
                // We don't have a token bucket for this category, so it will not be queued
                return(false);
            }
        }
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                                      List <SceneObjectGroup> objectGroups, IClientAPI remoteClient,
                                      bool permissionToDelete)
        {
            if (Enabled)
            {
                lock (m_inventoryTicker)
                    m_inventoryTicker.Stop();
            }

            DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();

            dtis.action             = action;
            dtis.folderID           = folderID;
            dtis.objectGroups       = objectGroups;
            dtis.remoteClient       = remoteClient;
            dtis.permissionToDelete = permissionToDelete;

            m_inventoryDeletes.Enqueue(dtis);

            if (Enabled)
            {
                lock (m_inventoryTicker)
                    m_inventoryTicker.Start();
            }

            // Visually remove it, even if it isnt really gone yet.  This means that if we crash before the object
            // has gone to inventory, it will reappear in the region again on restart instead of being lost.
            // This is not ideal since the object will still be available for manipulation when it should be, but it's
            // better than losing the object for now.
            if (permissionToDelete)
            {
                foreach (SceneObjectGroup g in objectGroups)
                {
                    g.DeleteGroupFromScene(false);
                }
            }
        }
Example #4
0
 protected void QueueMessage(ListenerInfo li)
 {
     m_pending.Enqueue(li);
 }