本文整理汇总了C#中OpenSim.Region.ClientStack.LindenUDP.OutgoingPacket.DecRef方法的典型用法代码示例。如果您正苦于以下问题:C# OutgoingPacket.DecRef方法的具体用法?C# OutgoingPacket.DecRef怎么用?C# OutgoingPacket.DecRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.ClientStack.LindenUDP.OutgoingPacket
的用法示例。
在下文中一共展示了OutgoingPacket.DecRef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnqueueOutgoing
public bool EnqueueOutgoing(OutgoingPacket packet)
{
int category = (int)packet.Category;
if (category >= 0 && category < m_packetOutboxes.Length)
{
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
// Not enough tokens in the bucket, queue this packet
//check the queue
//Dont drop resends this can mess up the buffer pool as well as make the connection situation much worse
if (_currentOutboundQueueSize > MAX_TOTAL_QUEUE_SIZE && (packet.Buffer[0] & Helpers.MSG_RESENT) == 0)
{
//queue already has too much data in it..
//can we drop this packet?
byte flags = packet.Buffer[0];
bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0;
if (!isReliable
&& packet.Type != PacketType.PacketAck
&& packet.Type != PacketType.CompletePingCheck)
{
//packet is unreliable and will be dropped
this.TestReportPacketDrop(packet);
packet.DecRef(m_udpServer.ByteBufferPool);
}
else
{
if (_currentOutboundQueueSize < MAX_TOTAL_QUEUE_SIZE * 1.5)
{
this.TestReportPacketShouldDrop(packet);
Interlocked.Add(ref _currentOutboundQueueSize, packet.DataSize);
packet.AddRef();
queue.Enqueue(packet);
}
else
{
//this connection is in a pretty critical state and probably will never catch up.
//drop all packets until we start to catch up. This includes acks which will disconnect
//the client eventually anyways
this.TestReportCriticalPacketDrop(packet);
packet.DecRef(m_udpServer.ByteBufferPool);
}
}
}
else
{
Interlocked.Add(ref _currentOutboundQueueSize, packet.DataSize);
packet.AddRef();
queue.Enqueue(packet);
}
return true;
}
else
{
// We don't have a token bucket for this category, so it will not be queued
return false;
}
}
示例2: SendCompleted
protected override void SendCompleted(OutgoingPacket packet)
{
packet.DecRef(_bufferPool);
}