From ac944def3fbea9cbad58780e3996e4c586237ab5 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 2 May 2009 00:14:04 +0000 Subject: Fix the issue that stopped the packet pool from working. Add a mechanism to recycley data blocs within a packet. Recycle the ObjectUpdate* data blocks. Speeds up loading even more. This may mean that the packet pool is now viable. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 13 +++++-------- OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs | 6 +++++- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 05ebcac..4acc6be 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2893,10 +2893,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) rotation = Quaternion.Identity; - ObjectUpdatePacket.ObjectDataBlock objectData = - new ObjectUpdatePacket.ObjectDataBlock(); - - objectData = CreatePrimUpdateBlock(primShape, flags); + ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(primShape, flags); objectData.ID = localID; objectData.FullID = objectID; @@ -3655,7 +3652,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { byte[] bytes = new byte[60]; int i = 0; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); + ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = PacketPool.GetDataBlock(); dat.TextureEntry = new byte[0]; // AvatarTemplate.TextureEntry; @@ -3750,7 +3747,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] bytes = new byte[60]; int i = 0; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); + ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = PacketPool.GetDataBlock(); dat.TextureEntry = new byte[0]; bytes[i++] = (byte)(ID % 256); bytes[i++] = (byte)((ID >> 8) % 256); @@ -3837,7 +3834,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(PrimitiveBaseShape primShape, uint flags) { - ObjectUpdatePacket.ObjectDataBlock objupdate = new ObjectUpdatePacket.ObjectDataBlock(); + ObjectUpdatePacket.ObjectDataBlock objupdate = PacketPool.GetDataBlock(); SetDefaultPrimPacketValues(objupdate); objupdate.UpdateFlags = flags; SetPrimPacketShapeData(objupdate, primShape); @@ -3908,7 +3905,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public ObjectUpdatePacket.ObjectDataBlock CreateDefaultAvatarPacket(byte[] textureEntry) { - ObjectUpdatePacket.ObjectDataBlock objdata = new ObjectUpdatePacket.ObjectDataBlock(); + ObjectUpdatePacket.ObjectDataBlock objdata = PacketPool.GetDataBlock(); // new OpenMetaverse.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); SetDefaultAvatarPacketValues(ref objdata); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs index 58777ab..2191ca7 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketHandler.cs @@ -586,7 +586,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; m_NeedAck.Remove(id); - PacketPool.Instance.ReturnPacket(data.Packet); + // We can't return this packet, it will just have to be GC'd + // Reason for that is that the packet may still be in the + // send queue, and if it gets reused things get messy! + // + // PacketPool.Instance.ReturnPacket(data.Packet); m_UnackedBytes -= data.Length; } } -- cgit v1.1