OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
/// <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>
Queue an outgoing packet if appropriate.
Queue an outgoing packet if appropriate .
public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue)
        {
            int category = (int)packet.Category;
            if (category >= 0 && category < m_packetOutboxes.Length)
            {
                OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
                TokenBucket bucket = m_throttleCategories[category];
                if (queue.Count > 0)
                {
                    queue.Enqueue(packet);
                    return true;
                }
                if (!forceQueue && bucket.RemoveTokens(packet.Buffer.DataLength))
                {
                    return false;
                }
                else
                {
                    queue.Enqueue(packet);
                    return true;
                }
            }
            else
            {
                return false;
            }
        }
public bool EnqueueOutgoing ( OutgoingPacket packet , bool forceQueue ) { int category = ( int ) packet . Category ; if ( category >= 0 && category < m_packetOutboxes . Length ) { OpenSim . Framework . LocklessQueue < OutgoingPacket > queue = m_packetOutboxes [ category ] ; TokenBucket bucket = m_throttleCategories [ category ] ; if ( queue . Count > 0 ) { queue . Enqueue ( packet ) ; return true ; } if ( ! forceQueue && bucket . RemoveTokens ( packet . Buffer . DataLength ) ) { return false ; } else { queue . Enqueue ( packet ) ; return true ; } } else { return false ; } }
Queue an outgoing packet if appropriate.
Queue an outgoing packet if appropriate .
// 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 // Enough tokens were removed from the bucket, the packet will not be queued // Force queue specified or not enough tokens in the bucket, queue this packet // We don't have a token bucket for this category, so it will not be queued
true if the packet has been queued,
false if the packet has not been queued and should be sent immediately.
true if the packet has been queued false if the packet has not been queued and should be sent immediately .
packet
OutgoingPacket
None
forceQueue
bool
Always queue the packet if at all possible.
Always queue the packet if at all possible .