From 79496381fc68cbd30ff5a95d1f05fcb18c6b1a93 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Fri, 28 Dec 2007 08:51:39 +0000 Subject: Patch from Johan: LibSL updated to the latest revision (1568) and all packets are now recycled to improve performance and memory usage. --- OpenSim/Region/Environment/LandManagement/Land.cs | 19 ++++++++++++------- .../Region/Environment/LandManagement/LandManager.cs | 5 +++-- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Environment/LandManagement') diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs index ff16319..5c99ffd 100644 --- a/OpenSim/Region/Environment/LandManagement/Land.cs +++ b/OpenSim/Region/Environment/LandManagement/Land.cs @@ -32,6 +32,7 @@ using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework; using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Interfaces; namespace OpenSim.Region.Environment.LandManagement { @@ -110,7 +111,9 @@ namespace OpenSim.Region.Environment.LandManagement public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) { - ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); + ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties); + // TODO: don't create new blocks if recycling an old packet + updatePacket.ParcelData.AABBMax = landData.AABBMax; updatePacket.ParcelData.AABBMin = landData.AABBMin; updatePacket.ParcelData.Area = landData.area; @@ -334,7 +337,7 @@ namespace OpenSim.Region.Environment.LandManagement if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) { - replyPacket = new ParcelAccessListReplyPacket(); + replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); replyPacket.Data.AgentID = agentID; replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; replyPacket.Data.LocalID = landData.localID; @@ -346,7 +349,7 @@ namespace OpenSim.Region.Environment.LandManagement if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) { - replyPacket = new ParcelAccessListReplyPacket(); + replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); replyPacket.Data.AgentID = agentID; replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; replyPacket.Data.LocalID = landData.localID; @@ -657,7 +660,8 @@ namespace OpenSim.Region.Environment.LandManagement bool firstCall = true; int MAX_OBJECTS_PER_PACKET = 251; - ForceObjectSelectPacket pack = new ForceObjectSelectPacket(); + ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect); + // TODO: don't create new blocks if recycling an old packet ForceObjectSelectPacket.DataBlock[] data; while (resultLocalIDs.Count > 0) { @@ -695,7 +699,9 @@ namespace OpenSim.Region.Environment.LandManagement public void sendLandObjectOwners(IClientAPI remote_client) { Dictionary ownersAndCount = new Dictionary(); - ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket(); + ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply); + // TODO: don't create new blocks if recycling an old packet + foreach (SceneObjectGroup obj in primsOverMe) { if (!ownersAndCount.ContainsKey(obj.OwnerID)) @@ -725,7 +731,6 @@ namespace OpenSim.Region.Environment.LandManagement num++; } - pack.Data = dataBlock; } remote_client.OutPacket(pack, ThrottleOutPacketType.Task); @@ -810,4 +815,4 @@ namespace OpenSim.Region.Environment.LandManagement } #endregion -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index 772fe2e..22e7fc9 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs @@ -33,6 +33,7 @@ using libsecondlife.Packets; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Physics.Manager; namespace OpenSim.Region.Environment.LandManagement @@ -493,7 +494,7 @@ namespace OpenSim.Region.Environment.LandManagement if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) { byteArrayCount = 0; - packet = new ParcelOverlayPacket(); + packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); packet.ParcelData.Data = byteArray; packet.ParcelData.SequenceID = sequenceID; remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task); @@ -856,4 +857,4 @@ namespace OpenSim.Region.Environment.LandManagement } #endregion -} \ No newline at end of file +} -- cgit v1.1