aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJohan Berntsson2008-01-03 00:59:12 +0000
committerJohan Berntsson2008-01-03 00:59:12 +0000
commit047aba2067b476b319e9b53924abea98ea8ba0d3 (patch)
treed7d62baa41e76bff29ab20a63f8ba541356bd533 /OpenSim
parentMinor refactoring to expose PrimInventory from SceneObjectPart (diff)
downloadopensim-SC_OLD-047aba2067b476b319e9b53924abea98ea8ba0d3.zip
opensim-SC_OLD-047aba2067b476b319e9b53924abea98ea8ba0d3.tar.gz
opensim-SC_OLD-047aba2067b476b319e9b53924abea98ea8ba0d3.tar.bz2
opensim-SC_OLD-047aba2067b476b319e9b53924abea98ea8ba0d3.tar.xz
I have fixed the ZeroDecodeCommand bug, and restored my packet recycling code. Let me know by IRC if there are other problems
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/ClientManager.cs3
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs132
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs10
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs2
8 files changed, 77 insertions, 80 deletions
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index f464015..181000c 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -148,7 +148,8 @@ namespace OpenSim.Framework
148 148
149 public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) 149 public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
150 { 150 {
151 ViewerEffectPacket packet = new ViewerEffectPacket(); 151 ViewerEffectPacket packet = (ViewerEffectPacket) PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
152 // TODO: don't create new blocks if recycling an old packet
152 packet.Effect = effectBlock; 153 packet.Effect = effectBlock;
153 154
154 // Wasteful, I know 155 // Wasteful, I know
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 066efef..f7fa775 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -216,7 +216,7 @@ namespace OpenSim.Region.ClientStack
216 { 216 {
217 m_scene.RemoveClient(AgentId); 217 m_scene.RemoveClient(AgentId);
218 // Send the STOP packet 218 // Send the STOP packet
219 DisableSimulatorPacket disable = new DisableSimulatorPacket(); 219 DisableSimulatorPacket disable = (DisableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
220 OutPacket(disable, ThrottleOutPacketType.Task); 220 OutPacket(disable, ThrottleOutPacketType.Task);
221 221
222 222
@@ -257,7 +257,7 @@ namespace OpenSim.Region.ClientStack
257 257
258 public void Kick(string message) 258 public void Kick(string message)
259 { 259 {
260 KickUserPacket kupack = new KickUserPacket(); 260 KickUserPacket kupack = (KickUserPacket) PacketPool.Instance.GetPacket(PacketType.KickUser);
261 kupack.UserInfo.AgentID = AgentId; 261 kupack.UserInfo.AgentID = AgentId;
262 kupack.UserInfo.SessionID = SessionId; 262 kupack.UserInfo.SessionID = SessionId;
263 kupack.TargetBlock.TargetIP = (uint) 0; 263 kupack.TargetBlock.TargetIP = (uint) 0;
@@ -600,7 +600,7 @@ namespace OpenSim.Region.ClientStack
600 /// <param name="regInfo"></param> 600 /// <param name="regInfo"></param>
601 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) 601 public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
602 { 602 {
603 AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); 603 AgentMovementCompletePacket mov = (AgentMovementCompletePacket) PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
604 mov.SimData.ChannelVersion = m_channelVersion; 604 mov.SimData.ChannelVersion = m_channelVersion;
605 mov.AgentData.SessionID = m_sessionId; 605 mov.AgentData.SessionID = m_sessionId;
606 mov.AgentData.AgentID = AgentId; 606 mov.AgentData.AgentID = AgentId;
@@ -635,7 +635,7 @@ namespace OpenSim.Region.ClientStack
635 635
636 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 636 public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
637 { 637 {
638 ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); 638 ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator);
639 reply.ChatData.Audible = 1; 639 reply.ChatData.Audible = 1;
640 reply.ChatData.Message = message; 640 reply.ChatData.Message = message;
641 reply.ChatData.ChatType = type; 641 reply.ChatData.ChatType = type;
@@ -656,7 +656,7 @@ namespace OpenSim.Region.ClientStack
656 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, 656 public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
657 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) 657 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp)
658 { 658 {
659 ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); 659 ImprovedInstantMessagePacket msg = (ImprovedInstantMessagePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
660 msg.AgentData.AgentID = fromAgent; 660 msg.AgentData.AgentID = fromAgent;
661 msg.AgentData.SessionID = fromAgentSession; 661 msg.AgentData.SessionID = fromAgentSession;
662 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName); 662 msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName);
@@ -744,7 +744,7 @@ namespace OpenSim.Region.ClientStack
744 IPAddress neighbourIP = neighbourEndPoint.Address; 744 IPAddress neighbourIP = neighbourEndPoint.Address;
745 ushort neighbourPort = (ushort) neighbourEndPoint.Port; 745 ushort neighbourPort = (ushort) neighbourEndPoint.Port;
746 746
747 EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); 747 EnableSimulatorPacket enablesimpacket = (EnableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.EnableSimulator);
748 // TODO: don't create new blocks if recycling an old packet 748 // TODO: don't create new blocks if recycling an old packet
749 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); 749 enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
750 enablesimpacket.SimulatorInfo.Handle = neighbourHandle; 750 enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
@@ -781,7 +781,7 @@ namespace OpenSim.Region.ClientStack
781 { 781 {
782 LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10); 782 LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10);
783 783
784 CrossedRegionPacket newSimPack = new CrossedRegionPacket(); 784 CrossedRegionPacket newSimPack = (CrossedRegionPacket) PacketPool.Instance.GetPacket(PacketType.CrossedRegion);
785 // TODO: don't create new blocks if recycling an old packet 785 // TODO: don't create new blocks if recycling an old packet
786 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); 786 newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock();
787 newSimPack.AgentData.AgentID = AgentId; 787 newSimPack.AgentData.AgentID = AgentId;
@@ -804,7 +804,7 @@ namespace OpenSim.Region.ClientStack
804 804
805 public void SendMapBlock(List<MapBlockData> mapBlocks) 805 public void SendMapBlock(List<MapBlockData> mapBlocks)
806 { 806 {
807 MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); 807 MapBlockReplyPacket mapReply = (MapBlockReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapBlockReply);
808 // TODO: don't create new blocks if recycling an old packet 808 // TODO: don't create new blocks if recycling an old packet
809 mapReply.AgentData.AgentID = AgentId; 809 mapReply.AgentData.AgentID = AgentId;
810 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; 810 mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count];
@@ -827,7 +827,7 @@ namespace OpenSim.Region.ClientStack
827 827
828 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) 828 public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags)
829 { 829 {
830 TeleportLocalPacket tpLocal = new TeleportLocalPacket(); 830 TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal);
831 tpLocal.Info.AgentID = AgentId; 831 tpLocal.Info.AgentID = AgentId;
832 tpLocal.Info.TeleportFlags = flags; 832 tpLocal.Info.TeleportFlags = flags;
833 tpLocal.Info.LocationID = 2; 833 tpLocal.Info.LocationID = 2;
@@ -839,7 +839,7 @@ namespace OpenSim.Region.ClientStack
839 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, 839 public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID,
840 uint flags, string capsURL) 840 uint flags, string capsURL)
841 { 841 {
842 TeleportFinishPacket teleport = new TeleportFinishPacket(); 842 TeleportFinishPacket teleport = (TeleportFinishPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFinish);
843 teleport.Info.AgentID = AgentId; 843 teleport.Info.AgentID = AgentId;
844 teleport.Info.RegionHandle = regionHandle; 844 teleport.Info.RegionHandle = regionHandle;
845 teleport.Info.SimAccess = simAccess; 845 teleport.Info.SimAccess = simAccess;
@@ -865,7 +865,7 @@ namespace OpenSim.Region.ClientStack
865 /// </summary> 865 /// </summary>
866 public void SendTeleportFailed() 866 public void SendTeleportFailed()
867 { 867 {
868 TeleportFailedPacket tpFailed = new TeleportFailedPacket(); 868 TeleportFailedPacket tpFailed = (TeleportFailedPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFailed);
869 tpFailed.Info.AgentID = AgentId; 869 tpFailed.Info.AgentID = AgentId;
870 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport"); 870 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport");
871 OutPacket(tpFailed, ThrottleOutPacketType.Task); 871 OutPacket(tpFailed, ThrottleOutPacketType.Task);
@@ -876,14 +876,14 @@ namespace OpenSim.Region.ClientStack
876 /// </summary> 876 /// </summary>
877 public void SendTeleportLocationStart() 877 public void SendTeleportLocationStart()
878 { 878 {
879 TeleportStartPacket tpStart = new TeleportStartPacket(); 879 TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart);
880 tpStart.Info.TeleportFlags = 16; // Teleport via location 880 tpStart.Info.TeleportFlags = 16; // Teleport via location
881 OutPacket(tpStart, ThrottleOutPacketType.Task); 881 OutPacket(tpStart, ThrottleOutPacketType.Task);
882 } 882 }
883 883
884 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) 884 public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance)
885 { 885 {
886 MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket(); 886 MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket) PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply);
887 money.MoneyData.AgentID = AgentId; 887 money.MoneyData.AgentID = AgentId;
888 money.MoneyData.TransactionID = transaction; 888 money.MoneyData.TransactionID = transaction;
889 money.MoneyData.TransactionSuccess = success; 889 money.MoneyData.TransactionSuccess = success;
@@ -894,7 +894,7 @@ namespace OpenSim.Region.ClientStack
894 894
895 public void SendStartPingCheck(byte seq) 895 public void SendStartPingCheck(byte seq)
896 { 896 {
897 StartPingCheckPacket pc = new StartPingCheckPacket(); 897 StartPingCheckPacket pc = (StartPingCheckPacket) PacketPool.Instance.GetPacket(PacketType.StartPingCheck);
898 pc.PingID.PingID = seq; 898 pc.PingID.PingID = seq;
899 pc.Header.Reliable = false; 899 pc.Header.Reliable = false;
900 OutPacket(pc, ThrottleOutPacketType.Task); 900 OutPacket(pc, ThrottleOutPacketType.Task);
@@ -902,7 +902,7 @@ namespace OpenSim.Region.ClientStack
902 902
903 public void SendKillObject(ulong regionHandle, uint localID) 903 public void SendKillObject(ulong regionHandle, uint localID)
904 { 904 {
905 KillObjectPacket kill = new KillObjectPacket(); 905 KillObjectPacket kill = (KillObjectPacket) PacketPool.Instance.GetPacket(PacketType.KillObject);
906 // TODO: don't create new blocks if recycling an old packet 906 // TODO: don't create new blocks if recycling an old packet
907 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 907 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
908 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); 908 kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
@@ -1096,7 +1096,7 @@ namespace OpenSim.Region.ClientStack
1096 1096
1097 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) 1097 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID)
1098 { 1098 {
1099 InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); 1099 InventoryDescendentsPacket descend = (InventoryDescendentsPacket) PacketPool.Instance.GetPacket(PacketType.InventoryDescendents);
1100 descend.AgentData.AgentID = AgentId; 1100 descend.AgentData.AgentID = AgentId;
1101 descend.AgentData.OwnerID = ownerID; 1101 descend.AgentData.OwnerID = ownerID;
1102 descend.AgentData.FolderID = folderID; 1102 descend.AgentData.FolderID = folderID;
@@ -1109,7 +1109,7 @@ namespace OpenSim.Region.ClientStack
1109 { 1109 {
1110 Encoding enc = Encoding.ASCII; 1110 Encoding enc = Encoding.ASCII;
1111 uint FULL_MASK_PERMISSIONS = 2147483647; 1111 uint FULL_MASK_PERMISSIONS = 2147483647;
1112 FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket(); 1112 FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket) PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply);
1113 // TODO: don't create new blocks if recycling an old packet 1113 // TODO: don't create new blocks if recycling an old packet
1114 inventoryReply.AgentData.AgentID = AgentId; 1114 inventoryReply.AgentData.AgentID = AgentId;
1115 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; 1115 inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1];
@@ -1151,7 +1151,7 @@ namespace OpenSim.Region.ClientStack
1151 { 1151 {
1152 Encoding enc = Encoding.ASCII; 1152 Encoding enc = Encoding.ASCII;
1153 uint FULL_MASK_PERMISSIONS = 2147483647; 1153 uint FULL_MASK_PERMISSIONS = 2147483647;
1154 UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); 1154 UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem);
1155 // TODO: don't create new blocks if recycling an old packet 1155 // TODO: don't create new blocks if recycling an old packet
1156 InventoryReply.AgentData.AgentID = AgentId; 1156 InventoryReply.AgentData.AgentID = AgentId;
1157 InventoryReply.AgentData.SimApproved = true; 1157 InventoryReply.AgentData.SimApproved = true;
@@ -1190,7 +1190,7 @@ namespace OpenSim.Region.ClientStack
1190 1190
1191 public void SendRemoveInventoryItem(LLUUID itemID) 1191 public void SendRemoveInventoryItem(LLUUID itemID)
1192 { 1192 {
1193 RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); 1193 RemoveInventoryItemPacket remove = (RemoveInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.RemoveInventoryItem);
1194 // TODO: don't create new blocks if recycling an old packet 1194 // TODO: don't create new blocks if recycling an old packet
1195 remove.AgentData.AgentID = AgentId; 1195 remove.AgentData.AgentID = AgentId;
1196 remove.AgentData.SessionID = m_sessionId; 1196 remove.AgentData.SessionID = m_sessionId;
@@ -1203,7 +1203,7 @@ namespace OpenSim.Region.ClientStack
1203 1203
1204 public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) 1204 public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName)
1205 { 1205 {
1206 ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); 1206 ReplyTaskInventoryPacket replytask = (ReplyTaskInventoryPacket) PacketPool.Instance.GetPacket(PacketType.ReplyTaskInventory);
1207 replytask.InventoryData.TaskID = taskID; 1207 replytask.InventoryData.TaskID = taskID;
1208 replytask.InventoryData.Serial = serial; 1208 replytask.InventoryData.Serial = serial;
1209 replytask.InventoryData.Filename = fileName; 1209 replytask.InventoryData.Filename = fileName;
@@ -1212,7 +1212,7 @@ namespace OpenSim.Region.ClientStack
1212 1212
1213 public void SendXferPacket(ulong xferID, uint packet, byte[] data) 1213 public void SendXferPacket(ulong xferID, uint packet, byte[] data)
1214 { 1214 {
1215 SendXferPacketPacket sendXfer = new SendXferPacketPacket(); 1215 SendXferPacketPacket sendXfer = (SendXferPacketPacket) PacketPool.Instance.GetPacket(PacketType.SendXferPacket);
1216 sendXfer.XferID.ID = xferID; 1216 sendXfer.XferID.ID = xferID;
1217 sendXfer.XferID.Packet = packet; 1217 sendXfer.XferID.Packet = packet;
1218 sendXfer.DataPacket.Data = data; 1218 sendXfer.DataPacket.Data = data;
@@ -1230,7 +1230,7 @@ namespace OpenSim.Region.ClientStack
1230 /// <param name="message"></param> 1230 /// <param name="message"></param>
1231 public void SendAlertMessage(string message) 1231 public void SendAlertMessage(string message)
1232 { 1232 {
1233 AlertMessagePacket alertPack = new AlertMessagePacket(); 1233 AlertMessagePacket alertPack = (AlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AlertMessage);
1234 alertPack.AlertData.Message = Helpers.StringToField(message); 1234 alertPack.AlertData.Message = Helpers.StringToField(message);
1235 OutPacket(alertPack, ThrottleOutPacketType.Task); 1235 OutPacket(alertPack, ThrottleOutPacketType.Task);
1236 } 1236 }
@@ -1242,7 +1242,7 @@ namespace OpenSim.Region.ClientStack
1242 /// <param name="modal"></param> 1242 /// <param name="modal"></param>
1243 public void SendAgentAlertMessage(string message, bool modal) 1243 public void SendAgentAlertMessage(string message, bool modal)
1244 { 1244 {
1245 AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket(); 1245 AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage);
1246 alertPack.AgentData.AgentID = AgentId; 1246 alertPack.AgentData.AgentID = AgentId;
1247 alertPack.AlertData.Message = Helpers.StringToField(message); 1247 alertPack.AlertData.Message = Helpers.StringToField(message);
1248 alertPack.AlertData.Modal = modal; 1248 alertPack.AlertData.Modal = modal;
@@ -1252,7 +1252,7 @@ namespace OpenSim.Region.ClientStack
1252 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, 1252 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
1253 string url) 1253 string url)
1254 { 1254 {
1255 LoadURLPacket loadURL = new LoadURLPacket(); 1255 LoadURLPacket loadURL = (LoadURLPacket) PacketPool.Instance.GetPacket(PacketType.LoadURL);
1256 loadURL.Data.ObjectName = Helpers.StringToField(objectname); 1256 loadURL.Data.ObjectName = Helpers.StringToField(objectname);
1257 loadURL.Data.ObjectID = objectID; 1257 loadURL.Data.ObjectID = objectID;
1258 loadURL.Data.OwnerID = ownerID; 1258 loadURL.Data.OwnerID = ownerID;
@@ -1278,7 +1278,7 @@ namespace OpenSim.Region.ClientStack
1278 1278
1279 public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) 1279 public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags)
1280 { 1280 {
1281 AttachedSoundPacket sound = new AttachedSoundPacket(); 1281 AttachedSoundPacket sound = (AttachedSoundPacket) PacketPool.Instance.GetPacket(PacketType.AttachedSound);
1282 sound.DataBlock.SoundID = soundID; 1282 sound.DataBlock.SoundID = soundID;
1283 sound.DataBlock.ObjectID = objectID; 1283 sound.DataBlock.ObjectID = objectID;
1284 sound.DataBlock.OwnerID = ownerID; 1284 sound.DataBlock.OwnerID = ownerID;
@@ -1290,7 +1290,7 @@ namespace OpenSim.Region.ClientStack
1290 1290
1291 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) 1291 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel)
1292 { 1292 {
1293 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); 1293 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
1294 viewertime.TimeInfo.SunDirection = sunPos; 1294 viewertime.TimeInfo.SunDirection = sunPos;
1295 viewertime.TimeInfo.SunAngVelocity = sunVel; 1295 viewertime.TimeInfo.SunAngVelocity = sunVel;
1296 viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); 1296 viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch();
@@ -1300,7 +1300,7 @@ namespace OpenSim.Region.ClientStack
1300 public void SendViewerTime(int phase) 1300 public void SendViewerTime(int phase)
1301 { 1301 {
1302 Console.WriteLine("SunPhase: {0}", phase); 1302 Console.WriteLine("SunPhase: {0}", phase);
1303 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); 1303 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
1304 //viewertime.TimeInfo.SecPerDay = 86400; 1304 //viewertime.TimeInfo.SecPerDay = 86400;
1305 //viewertime.TimeInfo.SecPerYear = 31536000; 1305 //viewertime.TimeInfo.SecPerYear = 31536000;
1306 viewertime.TimeInfo.SecPerDay = 1000; 1306 viewertime.TimeInfo.SecPerDay = 1000;
@@ -1349,7 +1349,7 @@ namespace OpenSim.Region.ClientStack
1349 string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, 1349 string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL,
1350 LLUUID partnerID) 1350 LLUUID partnerID)
1351 { 1351 {
1352 AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket(); 1352 AvatarPropertiesReplyPacket avatarReply = (AvatarPropertiesReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPropertiesReply);
1353 avatarReply.AgentData.AgentID = AgentId; 1353 avatarReply.AgentData.AgentID = AgentId;
1354 avatarReply.AgentData.AvatarID = avatarID; 1354 avatarReply.AgentData.AvatarID = avatarID;
1355 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); 1355 avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText);
@@ -1374,7 +1374,7 @@ namespace OpenSim.Region.ClientStack
1374 /// <param name="wearables"></param> 1374 /// <param name="wearables"></param>
1375 public void SendWearables(AvatarWearable[] wearables, int serial) 1375 public void SendWearables(AvatarWearable[] wearables, int serial)
1376 { 1376 {
1377 AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); 1377 AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket) PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate);
1378 aw.AgentData.AgentID = AgentId; 1378 aw.AgentData.AgentID = AgentId;
1379 aw.AgentData.SerialNum = (uint) serial; 1379 aw.AgentData.SerialNum = (uint) serial;
1380 aw.AgentData.SessionID = m_sessionId; 1380 aw.AgentData.SessionID = m_sessionId;
@@ -1402,7 +1402,7 @@ namespace OpenSim.Region.ClientStack
1402 /// <param name="textureEntry"></param> 1402 /// <param name="textureEntry"></param>
1403 public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) 1403 public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
1404 { 1404 {
1405 AvatarAppearancePacket avp = new AvatarAppearancePacket(); 1405 AvatarAppearancePacket avp = (AvatarAppearancePacket) PacketPool.Instance.GetPacket(PacketType.AvatarAppearance);
1406 // TODO: don't create new blocks if recycling an old packet 1406 // TODO: don't create new blocks if recycling an old packet
1407 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; 1407 avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
1408 avp.ObjectData.TextureEntry = textureEntry; 1408 avp.ObjectData.TextureEntry = textureEntry;
@@ -1422,7 +1422,7 @@ namespace OpenSim.Region.ClientStack
1422 1422
1423 public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId) 1423 public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId)
1424 { 1424 {
1425 AvatarAnimationPacket ani = new AvatarAnimationPacket(); 1425 AvatarAnimationPacket ani = (AvatarAnimationPacket) PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
1426 // TODO: don't create new blocks if recycling an old packet 1426 // TODO: don't create new blocks if recycling an old packet
1427 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; 1427 ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
1428 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); 1428 ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock();
@@ -1457,7 +1457,7 @@ namespace OpenSim.Region.ClientStack
1457 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, 1457 public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
1458 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) 1458 uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID)
1459 { 1459 {
1460 ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); 1460 ObjectUpdatePacket objupdate = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
1461 // TODO: don't create new blocks if recycling an old packet 1461 // TODO: don't create new blocks if recycling an old packet
1462 objupdate.RegionData.RegionHandle = regionHandle; 1462 objupdate.RegionData.RegionHandle = regionHandle;
1463 objupdate.RegionData.TimeDilation = 64096; 1463 objupdate.RegionData.TimeDilation = 64096;
@@ -1490,7 +1490,7 @@ namespace OpenSim.Region.ClientStack
1490 { 1490 {
1491 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = 1491 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
1492 CreateAvatarImprovedBlock(localID, position, velocity, rotation); 1492 CreateAvatarImprovedBlock(localID, position, velocity, rotation);
1493 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 1493 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
1494 // TODO: don't create new blocks if recycling an old packet 1494 // TODO: don't create new blocks if recycling an old packet
1495 terse.RegionData.RegionHandle = regionHandle; 1495 terse.RegionData.RegionHandle = regionHandle;
1496 terse.RegionData.TimeDilation = timeDilation; 1496 terse.RegionData.TimeDilation = timeDilation;
@@ -1502,7 +1502,7 @@ namespace OpenSim.Region.ClientStack
1502 1502
1503 public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) 1503 public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations)
1504 { 1504 {
1505 CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket(); 1505 CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket) PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate);
1506 // TODO: don't create new blocks if recycling an old packet 1506 // TODO: don't create new blocks if recycling an old packet
1507 int total = CoarseLocations.Count; 1507 int total = CoarseLocations.Count;
1508 CoarseLocationUpdatePacket.IndexBlock ib = 1508 CoarseLocationUpdatePacket.IndexBlock ib =
@@ -1535,7 +1535,7 @@ namespace OpenSim.Region.ClientStack
1535 /// <param name="attachPoint"></param> 1535 /// <param name="attachPoint"></param>
1536 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) 1536 public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint)
1537 { 1537 {
1538 ObjectAttachPacket attach = new ObjectAttachPacket(); 1538 ObjectAttachPacket attach = (ObjectAttachPacket) PacketPool.Instance.GetPacket(PacketType.ObjectAttach);
1539 // TODO: don't create new blocks if recycling an old packet 1539 // TODO: don't create new blocks if recycling an old packet
1540 attach.AgentData.AgentID = AgentId; 1540 attach.AgentData.AgentID = AgentId;
1541 attach.AgentData.SessionID = m_sessionId; 1541 attach.AgentData.SessionID = m_sessionId;
@@ -1555,7 +1555,7 @@ namespace OpenSim.Region.ClientStack
1555 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, 1555 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem,
1556 LLQuaternion rotation, byte clickAction) 1556 LLQuaternion rotation, byte clickAction)
1557 { 1557 {
1558 ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); 1558 ObjectUpdatePacket outPacket = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
1559 // TODO: don't create new blocks if recycling an old packet 1559 // TODO: don't create new blocks if recycling an old packet
1560 outPacket.RegionData.RegionHandle = regionHandle; 1560 outPacket.RegionData.RegionHandle = regionHandle;
1561 outPacket.RegionData.TimeDilation = timeDilation; 1561 outPacket.RegionData.TimeDilation = timeDilation;
@@ -1599,7 +1599,7 @@ namespace OpenSim.Region.ClientStack
1599 { 1599 {
1600 LLVector3 velocity = new LLVector3(0f, 0f, 0f); 1600 LLVector3 velocity = new LLVector3(0f, 0f, 0f);
1601 LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f); 1601 LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f);
1602 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 1602 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
1603 // TODO: don't create new blocks if recycling an old packet 1603 // TODO: don't create new blocks if recycling an old packet
1604 terse.RegionData.RegionHandle = regionHandle; 1604 terse.RegionData.RegionHandle = regionHandle;
1605 terse.RegionData.TimeDilation = timeDilation; 1605 terse.RegionData.TimeDilation = timeDilation;
@@ -1612,7 +1612,7 @@ namespace OpenSim.Region.ClientStack
1612 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 1612 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
1613 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity) 1613 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
1614 { 1614 {
1615 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 1615 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
1616 // TODO: don't create new blocks if recycling an old packet 1616 // TODO: don't create new blocks if recycling an old packet
1617 terse.RegionData.RegionHandle = regionHandle; 1617 terse.RegionData.RegionHandle = regionHandle;
1618 terse.RegionData.TimeDilation = timeDilation; 1618 terse.RegionData.TimeDilation = timeDilation;
@@ -1950,8 +1950,8 @@ namespace OpenSim.Region.ClientStack
1950 1950
1951 public void SendNameReply(LLUUID profileId, string firstname, string lastname) 1951 public void SendNameReply(LLUUID profileId, string firstname, string lastname)
1952 { 1952 {
1953 UUIDNameReplyPacket packet = new UUIDNameReplyPacket(); 1953 UUIDNameReplyPacket packet = (UUIDNameReplyPacket) PacketPool.Instance.GetPacket(PacketType.UUIDNameReply);
1954 1954 // TODO: don't create new blocks if recycling an old packet
1955 packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; 1955 packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1];
1956 packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); 1956 packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock();
1957 packet.UUIDNameBlock[0].ID = profileId; 1957 packet.UUIDNameBlock[0].ID = profileId;
@@ -1999,7 +1999,7 @@ namespace OpenSim.Region.ClientStack
1999 { 1999 {
2000 //System.Console.WriteLine("texture cached: " + packet.ToString()); 2000 //System.Console.WriteLine("texture cached: " + packet.ToString());
2001 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet; 2001 AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet;
2002 AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); 2002 AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket) PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
2003 // TODO: don't create new blocks if recycling an old packet 2003 // TODO: don't create new blocks if recycling an old packet
2004 cachedresp.AgentData.AgentID = AgentId; 2004 cachedresp.AgentData.AgentID = AgentId;
2005 cachedresp.AgentData.SessionID = m_sessionId; 2005 cachedresp.AgentData.SessionID = m_sessionId;
@@ -2160,7 +2160,7 @@ namespace OpenSim.Region.ClientStack
2160 { 2160 {
2161 //should be getting the map layer from the grid server 2161 //should be getting the map layer from the grid server
2162 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) 2162 //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area)
2163 MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); 2163 MapLayerReplyPacket mapReply = (MapLayerReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapLayerReply);
2164 // TODO: don't create new blocks if recycling an old packet 2164 // TODO: don't create new blocks if recycling an old packet
2165 mapReply.AgentData.AgentID = AgentId; 2165 mapReply.AgentData.AgentID = AgentId;
2166 mapReply.AgentData.Flags = 0; 2166 mapReply.AgentData.Flags = 0;
@@ -2305,22 +2305,18 @@ namespace OpenSim.Region.ClientStack
2305 // Actually make the byte array and send it 2305 // Actually make the byte array and send it
2306 try 2306 try
2307 { 2307 {
2308 byte[] sendbuffer = Pack.ToBytes(); 2308 byte[] sendbuffer = Pack.ToBytes();
2309 if (Pack is RegionHandshakePacket) 2309 PacketPool.Instance.ReturnPacket(Pack);
2310 { 2310
2311 PacketPool.Instance.ReturnPacket(Pack); 2311 if (Pack.Header.Zerocoded)
2312 } 2312 {
2313 2313 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
2314 if (Pack.Header.Zerocoded) 2314 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
2315 { 2315 }
2316 byte[] ZeroOutBuffer = new byte[4096]; 2316 else
2317 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 2317 {
2318 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); 2318 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
2319 } 2319 }
2320 else
2321 {
2322 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
2323 }
2324 } 2320 }
2325 catch (Exception e) 2321 catch (Exception e)
2326 { 2322 {
@@ -2366,7 +2362,7 @@ namespace OpenSim.Region.ClientStack
2366 { 2362 {
2367 //reply to pingcheck 2363 //reply to pingcheck
2368 StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack; 2364 StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack;
2369 CompletePingCheckPacket endPing = new CompletePingCheckPacket(); 2365 CompletePingCheckPacket endPing = (CompletePingCheckPacket) PacketPool.Instance.GetPacket(PacketType.CompletePingCheck);
2370 endPing.PingID.PingID = startPing.PingID.PingID; 2366 endPing.PingID.PingID = startPing.PingID.PingID;
2371 OutPacket(endPing, ThrottleOutPacketType.Task); 2367 OutPacket(endPing, ThrottleOutPacketType.Task);
2372 } 2368 }
@@ -2395,7 +2391,7 @@ namespace OpenSim.Region.ClientStack
2395 { 2391 {
2396 if (Pack.Header.Reliable) 2392 if (Pack.Header.Reliable)
2397 { 2393 {
2398 PacketAckPacket ack_it = new PacketAckPacket(); 2394 PacketAckPacket ack_it = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck);
2399 // TODO: don't create new blocks if recycling an old packet 2395 // TODO: don't create new blocks if recycling an old packet
2400 ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; 2396 ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
2401 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); 2397 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
@@ -2451,7 +2447,7 @@ namespace OpenSim.Region.ClientStack
2451 //MainLog.Instance.Verbose("NETWORK", "Sending PacketAck"); 2447 //MainLog.Instance.Verbose("NETWORK", "Sending PacketAck");
2452 2448
2453 int i = 0; 2449 int i = 0;
2454 PacketAckPacket acks = new PacketAckPacket(); 2450 PacketAckPacket acks = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck);
2455 // TODO: don't create new blocks if recycling an old packet 2451 // TODO: don't create new blocks if recycling an old packet
2456 acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count]; 2452 acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count];
2457 2453
@@ -3226,11 +3222,11 @@ namespace OpenSim.Region.ClientStack
3226 case PacketType.TeleportLandmarkRequest: 3222 case PacketType.TeleportLandmarkRequest:
3227 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack; 3223 TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack;
3228 3224
3229 TeleportStartPacket tpStart = new TeleportStartPacket(); 3225 TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart);
3230 tpStart.Info.TeleportFlags = 8; // tp via lm 3226 tpStart.Info.TeleportFlags = 8; // tp via lm
3231 OutPacket(tpStart, ThrottleOutPacketType.Task); 3227 OutPacket(tpStart, ThrottleOutPacketType.Task);
3232 3228
3233 TeleportProgressPacket tpProgress = new TeleportProgressPacket(); 3229 TeleportProgressPacket tpProgress = (TeleportProgressPacket) PacketPool.Instance.GetPacket(PacketType.TeleportProgress);
3234 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); 3230 tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark");
3235 tpProgress.Info.TeleportFlags = 8; 3231 tpProgress.Info.TeleportFlags = 8;
3236 tpProgress.AgentData.AgentID = tpReq.Info.AgentID; 3232 tpProgress.AgentData.AgentID = tpReq.Info.AgentID;
@@ -3245,7 +3241,7 @@ namespace OpenSim.Region.ClientStack
3245 3241
3246 if (lm.RegionID == m_scene.RegionInfo.RegionID) 3242 if (lm.RegionID == m_scene.RegionInfo.RegionID)
3247 { 3243 {
3248 TeleportLocalPacket tpLocal = new TeleportLocalPacket(); 3244 TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal);
3249 3245
3250 tpLocal.Info.AgentID = tpReq.Info.AgentID; 3246 tpLocal.Info.AgentID = tpReq.Info.AgentID;
3251 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark 3247 tpLocal.Info.TeleportFlags = 8; // Teleport via landmark
@@ -3255,7 +3251,7 @@ namespace OpenSim.Region.ClientStack
3255 } 3251 }
3256 else 3252 else
3257 { 3253 {
3258 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 3254 TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
3259 tpCancel.Info.AgentID = tpReq.Info.AgentID; 3255 tpCancel.Info.AgentID = tpReq.Info.AgentID;
3260 tpCancel.Info.SessionID = tpReq.Info.SessionID; 3256 tpCancel.Info.SessionID = tpReq.Info.SessionID;
3261 OutPacket(tpCancel, ThrottleOutPacketType.Task); 3257 OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3265,7 +3261,7 @@ namespace OpenSim.Region.ClientStack
3265 { 3261 {
3266 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); 3262 Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented");
3267 3263
3268 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 3264 TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
3269 tpCancel.Info.AgentID = tpReq.Info.AgentID; 3265 tpCancel.Info.AgentID = tpReq.Info.AgentID;
3270 tpCancel.Info.SessionID = tpReq.Info.SessionID; 3266 tpCancel.Info.SessionID = tpReq.Info.SessionID;
3271 OutPacket(tpCancel, ThrottleOutPacketType.Task); 3267 OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3283,7 +3279,7 @@ namespace OpenSim.Region.ClientStack
3283 else 3279 else
3284 { 3280 {
3285 //no event handler so cancel request 3281 //no event handler so cancel request
3286 TeleportCancelPacket tpCancel = new TeleportCancelPacket(); 3282 TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
3287 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; 3283 tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID;
3288 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; 3284 tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID;
3289 OutPacket(tpCancel, ThrottleOutPacketType.Task); 3285 OutPacket(tpCancel, ThrottleOutPacketType.Task);
@@ -3591,7 +3587,7 @@ namespace OpenSim.Region.ClientStack
3591 3587
3592 public void SendLogoutPacket() 3588 public void SendLogoutPacket()
3593 { 3589 {
3594 LogoutReplyPacket logReply = new LogoutReplyPacket(); 3590 LogoutReplyPacket logReply = (LogoutReplyPacket) PacketPool.Instance.GetPacket(PacketType.LogoutReply);
3595 // TODO: don't create new blocks if recycling an old packet 3591 // TODO: don't create new blocks if recycling an old packet
3596 logReply.AgentData.AgentID = AgentId; 3592 logReply.AgentData.AgentID = AgentId;
3597 logReply.AgentData.SessionID = SessionId; 3593 logReply.AgentData.SessionID = SessionId;
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index bd26fdf..5c99ffd 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Environment.LandManagement
111 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, 111 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result,
112 IClientAPI remote_client) 112 IClientAPI remote_client)
113 { 113 {
114 ParcelPropertiesPacket updatePacket = new ParcelPropertiesPacket(); 114 ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ParcelProperties);
115 // TODO: don't create new blocks if recycling an old packet 115 // TODO: don't create new blocks if recycling an old packet
116 116
117 updatePacket.ParcelData.AABBMax = landData.AABBMax; 117 updatePacket.ParcelData.AABBMax = landData.AABBMax;
@@ -337,7 +337,7 @@ namespace OpenSim.Region.Environment.LandManagement
337 337
338 if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) 338 if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both)
339 { 339 {
340 replyPacket = new ParcelAccessListReplyPacket(); 340 replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
341 replyPacket.Data.AgentID = agentID; 341 replyPacket.Data.AgentID = agentID;
342 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; 342 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access;
343 replyPacket.Data.LocalID = landData.localID; 343 replyPacket.Data.LocalID = landData.localID;
@@ -349,7 +349,7 @@ namespace OpenSim.Region.Environment.LandManagement
349 349
350 if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) 350 if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
351 { 351 {
352 replyPacket = new ParcelAccessListReplyPacket(); 352 replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply);
353 replyPacket.Data.AgentID = agentID; 353 replyPacket.Data.AgentID = agentID;
354 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; 354 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban;
355 replyPacket.Data.LocalID = landData.localID; 355 replyPacket.Data.LocalID = landData.localID;
@@ -660,7 +660,7 @@ namespace OpenSim.Region.Environment.LandManagement
660 660
661 bool firstCall = true; 661 bool firstCall = true;
662 int MAX_OBJECTS_PER_PACKET = 251; 662 int MAX_OBJECTS_PER_PACKET = 251;
663 ForceObjectSelectPacket pack = new ForceObjectSelectPacket(); 663 ForceObjectSelectPacket pack = (ForceObjectSelectPacket) PacketPool.Instance.GetPacket(PacketType.ForceObjectSelect);
664 // TODO: don't create new blocks if recycling an old packet 664 // TODO: don't create new blocks if recycling an old packet
665 ForceObjectSelectPacket.DataBlock[] data; 665 ForceObjectSelectPacket.DataBlock[] data;
666 while (resultLocalIDs.Count > 0) 666 while (resultLocalIDs.Count > 0)
@@ -699,7 +699,7 @@ namespace OpenSim.Region.Environment.LandManagement
699 public void sendLandObjectOwners(IClientAPI remote_client) 699 public void sendLandObjectOwners(IClientAPI remote_client)
700 { 700 {
701 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); 701 Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>();
702 ParcelObjectOwnersReplyPacket pack = new ParcelObjectOwnersReplyPacket(); 702 ParcelObjectOwnersReplyPacket pack = (ParcelObjectOwnersReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelObjectOwnersReply);
703 // TODO: don't create new blocks if recycling an old packet 703 // TODO: don't create new blocks if recycling an old packet
704 704
705 foreach (SceneObjectGroup obj in primsOverMe) 705 foreach (SceneObjectGroup obj in primsOverMe)
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index d463964..22e7fc9 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -494,7 +494,7 @@ namespace OpenSim.Region.Environment.LandManagement
494 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) 494 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
495 { 495 {
496 byteArrayCount = 0; 496 byteArrayCount = 0;
497 packet = new ParcelOverlayPacket(); 497 packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay);
498 packet.ParcelData.Data = byteArray; 498 packet.ParcelData.Data = byteArray;
499 packet.ParcelData.SequenceID = sequenceID; 499 packet.ParcelData.SequenceID = sequenceID;
500 remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task); 500 remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index af4573b..647fbf4 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
166 List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); 166 List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>();
167 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); 167 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query);
168 168
169 AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket(); 169 AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply);
170 // TODO: don't create new blocks if recycling an old packet 170 // TODO: don't create new blocks if recycling an old packet
171 171
172 AvatarPickerReplyPacket.DataBlock[] searchData = 172 AvatarPickerReplyPacket.DataBlock[] searchData =
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 09b58e0..8032502 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1496,7 +1496,7 @@ namespace OpenSim.Region.Environment.Scenes
1496 m_innerScene.removeUserCount(true); 1496 m_innerScene.removeUserCount(true);
1497 } 1497 }
1498 // Tell a single agent to disconnect from the region. 1498 // Tell a single agent to disconnect from the region.
1499 DisableSimulatorPacket disable = new DisableSimulatorPacket(); 1499 libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator);
1500 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); 1500 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task);
1501 } 1501 }
1502 } 1502 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 3fc7aec..94b6797 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -636,7 +636,7 @@ namespace OpenSim.Region.Environment.Scenes
636 public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags) 636 public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags)
637 { 637 {
638 //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); 638 //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags);
639 ObjectPropertiesFamilyPacket objPropFamilyPack = new ObjectPropertiesFamilyPacket(); 639 ObjectPropertiesFamilyPacket objPropFamilyPack = (ObjectPropertiesFamilyPacket) PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily);
640 // TODO: don't create new blocks if recycling an old packet 640 // TODO: don't create new blocks if recycling an old packet
641 641
642 ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); 642 ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock();
@@ -1045,7 +1045,7 @@ namespace OpenSim.Region.Environment.Scenes
1045 /// <param name="client"></param> 1045 /// <param name="client"></param>
1046 public void GetProperites(IClientAPI client) 1046 public void GetProperites(IClientAPI client)
1047 { 1047 {
1048 ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); 1048 ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
1049 // TODO: don't create new blocks if recycling an old packet 1049 // TODO: don't create new blocks if recycling an old packet
1050 1050
1051 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 1051 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index d955fe7..5033965 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Scenes
83 private void statsHeartBeat(object sender, EventArgs e) 83 private void statsHeartBeat(object sender, EventArgs e)
84 { 84 {
85 m_report.Enabled = false; 85 m_report.Enabled = false;
86 SimStatsPacket statpack = new SimStatsPacket(); 86 SimStatsPacket statpack = (SimStatsPacket) PacketPool.Instance.GetPacket(PacketType.SimStats);
87 // TODO: don't create new blocks if recycling an old packet 87 // TODO: don't create new blocks if recycling an old packet
88 88
89 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; 89 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11];