avoid data references stuck in packet pools
parent
91986445a6
commit
d179b2dda1
|
@ -2142,7 +2142,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
HTTPDRunning = false;
|
||||
|
||||
|
||||
StatsManager.DeregisterStat(m_requestsProcessedStat);
|
||||
|
||||
try
|
||||
|
|
|
@ -466,7 +466,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
m_circuitManager = circuitManager;
|
||||
int sceneThrottleBps = 0;
|
||||
bool usePools = false;
|
||||
// bool usePools = false;
|
||||
|
||||
IConfig config = configSource.Configs["ClientStack.LindenUDP"];
|
||||
if (config != null)
|
||||
|
@ -497,8 +497,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (packetConfig != null)
|
||||
{
|
||||
PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true);
|
||||
PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true);
|
||||
usePools = packetConfig.GetBoolean("RecycleBaseUDPPackets", usePools);
|
||||
// PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true);
|
||||
// usePools = packetConfig.GetBoolean("RecycleBaseUDPPackets", usePools);
|
||||
}
|
||||
|
||||
#region BinaryStats
|
||||
|
@ -896,7 +896,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting, UnackedPacketMethod method)
|
||||
{
|
||||
// CoarseLocationUpdate packets cannot be split in an automated way
|
||||
if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
|
||||
if (allowSplitting && packet.Type == PacketType.CoarseLocationUpdate)
|
||||
allowSplitting = false;
|
||||
|
||||
// bool packetQueued = false;
|
||||
|
@ -1055,7 +1055,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
public void SendPing(LLUDPClient udpClient)
|
||||
{
|
||||
StartPingCheckPacket pc = (StartPingCheckPacket)PacketPool.Instance.GetPacket(PacketType.StartPingCheck);
|
||||
pc.Header.Reliable = false;
|
||||
|
||||
pc.PingID.PingID = (byte)udpClient.CurrentPingSequence++;
|
||||
// We *could* get OldestUnacked, but it would hurt performance and not provide any benefit
|
||||
|
@ -1963,7 +1962,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
|
||||
|
||||
|
||||
client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
|
||||
client.OnLogout += LogoutHandler;
|
||||
client.DebugPacketLevel = DefaultClientPacketDebugLevel;
|
||||
|
|
|
@ -105,7 +105,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
// defaults
|
||||
RecyclePackets = true;
|
||||
RecycleDataBlocks = true;
|
||||
// RecycleDataBlocks = true;
|
||||
RecycleDataBlocks = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -198,43 +199,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <param name="packet"></param>
|
||||
public void ReturnPacket(Packet packet)
|
||||
{
|
||||
if (RecycleDataBlocks)
|
||||
{
|
||||
switch (packet.Type)
|
||||
if (!RecyclePackets)
|
||||
return;
|
||||
|
||||
bool trypool = false;
|
||||
PacketType type = packet.Type;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case PacketType.ObjectUpdate:
|
||||
ObjectUpdatePacket oup = (ObjectUpdatePacket)packet;
|
||||
|
||||
if (RecycleDataBlocks)
|
||||
{
|
||||
foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData)
|
||||
ReturnDataBlock<ObjectUpdatePacket.ObjectDataBlock>(oupod);
|
||||
}
|
||||
|
||||
oup.ObjectData = null;
|
||||
trypool = true;
|
||||
break;
|
||||
|
||||
case PacketType.ImprovedTerseObjectUpdate:
|
||||
ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet;
|
||||
|
||||
if (RecycleDataBlocks)
|
||||
{
|
||||
foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData)
|
||||
ReturnDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(itoupod);
|
||||
}
|
||||
|
||||
itoup.ObjectData = null;
|
||||
trypool = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (RecyclePackets)
|
||||
{
|
||||
switch (packet.Type)
|
||||
{
|
||||
// List pooling packets here
|
||||
case PacketType.AgentUpdate:
|
||||
case PacketType.PacketAck:
|
||||
case PacketType.ObjectUpdate:
|
||||
case PacketType.ImprovedTerseObjectUpdate:
|
||||
trypool = true;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if(!trypool)
|
||||
return;
|
||||
|
||||
lock (pool)
|
||||
{
|
||||
PacketType type = packet.Type;
|
||||
|
||||
if (!pool.ContainsKey(type))
|
||||
{
|
||||
pool[type] = new Stack<Packet>();
|
||||
|
@ -243,17 +254,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if ((pool[type]).Count < 50)
|
||||
{
|
||||
// m_log.DebugFormat("[PACKETPOOL]: Pushing {0} packet", type);
|
||||
|
||||
pool[type].Push(packet);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Other packets wont pool
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public T GetDataBlock<T>() where T: new()
|
||||
|
|
Loading…
Reference in New Issue