diff options
author | Adam Johnson | 2007-12-28 08:51:39 +0000 |
---|---|---|
committer | Adam Johnson | 2007-12-28 08:51:39 +0000 |
commit | 79496381fc68cbd30ff5a95d1f05fcb18c6b1a93 (patch) | |
tree | 036414391293354da62fe9eac1895483111480a3 /OpenSim/Region | |
parent | * Moved PrimitiveBaseShape subclasses into factory methods - the subclassing ... (diff) | |
download | opensim-SC_OLD-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.zip opensim-SC_OLD-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.gz opensim-SC_OLD-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.bz2 opensim-SC_OLD-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.xz |
Patch from Johan: LibSL updated to the latest revision (1568) and all packets are now
recycled to improve performance and memory usage.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 175 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/UDPServer.cs | 100 | ||||
-rw-r--r-- | OpenSim/Region/Environment/LandManagement/Land.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Environment/LandManagement/LandManager.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 71 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 6 |
8 files changed, 166 insertions, 231 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index dcb1a47..aed2c29 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -66,6 +66,7 @@ namespace OpenSim.Region.ClientStack | |||
66 | private int m_packetsReceived = 0; | 66 | private int m_packetsReceived = 0; |
67 | private int m_probesWithNoIngressPackets = 0; | 67 | private int m_probesWithNoIngressPackets = 0; |
68 | private int m_lastPacketsReceived = 0; | 68 | private int m_lastPacketsReceived = 0; |
69 | private byte[] ZeroOutBuffer = new byte[4096]; | ||
69 | 70 | ||
70 | private readonly Encoding m_encoding = Encoding.ASCII; | 71 | private readonly Encoding m_encoding = Encoding.ASCII; |
71 | private readonly LLUUID m_agentId; | 72 | private readonly LLUUID m_agentId; |
@@ -215,7 +216,7 @@ namespace OpenSim.Region.ClientStack | |||
215 | { | 216 | { |
216 | m_scene.RemoveClient(AgentId); | 217 | m_scene.RemoveClient(AgentId); |
217 | // Send the STOP packet | 218 | // Send the STOP packet |
218 | DisableSimulatorPacket disable = new DisableSimulatorPacket(); | 219 | DisableSimulatorPacket disable = (DisableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.DisableSimulator); |
219 | OutPacket(disable, ThrottleOutPacketType.Task); | 220 | OutPacket(disable, ThrottleOutPacketType.Task); |
220 | 221 | ||
221 | 222 | ||
@@ -256,7 +257,7 @@ namespace OpenSim.Region.ClientStack | |||
256 | 257 | ||
257 | public void Kick(string message) | 258 | public void Kick(string message) |
258 | { | 259 | { |
259 | KickUserPacket kupack = new KickUserPacket(); | 260 | KickUserPacket kupack = (KickUserPacket) PacketPool.Instance.GetPacket(PacketType.KickUser); |
260 | kupack.UserInfo.AgentID = AgentId; | 261 | kupack.UserInfo.AgentID = AgentId; |
261 | kupack.UserInfo.SessionID = SessionId; | 262 | kupack.UserInfo.SessionID = SessionId; |
262 | kupack.TargetBlock.TargetIP = (uint) 0; | 263 | kupack.TargetBlock.TargetIP = (uint) 0; |
@@ -558,8 +559,7 @@ namespace OpenSim.Region.ClientStack | |||
558 | /// <param name="regionInfo"></param> | 559 | /// <param name="regionInfo"></param> |
559 | public void SendRegionHandshake(RegionInfo regionInfo) | 560 | public void SendRegionHandshake(RegionInfo regionInfo) |
560 | { | 561 | { |
561 | RegionHandshakePacket handshake = | 562 | RegionHandshakePacket handshake = (RegionHandshakePacket) PacketPool.Instance.GetPacket(PacketType.RegionHandshake); |
562 | (RegionHandshakePacket) PacketPool.Instance.GetPacket(PacketType.RegionHandshake); | ||
563 | 563 | ||
564 | handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor; | 564 | handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor; |
565 | handshake.RegionInfo.IsEstateManager = false; | 565 | handshake.RegionInfo.IsEstateManager = false; |
@@ -596,7 +596,7 @@ namespace OpenSim.Region.ClientStack | |||
596 | /// <param name="regInfo"></param> | 596 | /// <param name="regInfo"></param> |
597 | public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) | 597 | public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look) |
598 | { | 598 | { |
599 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | 599 | AgentMovementCompletePacket mov = (AgentMovementCompletePacket) PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); |
600 | mov.SimData.ChannelVersion = m_channelVersion; | 600 | mov.SimData.ChannelVersion = m_channelVersion; |
601 | mov.AgentData.SessionID = m_sessionId; | 601 | mov.AgentData.SessionID = m_sessionId; |
602 | mov.AgentData.AgentID = AgentId; | 602 | mov.AgentData.AgentID = AgentId; |
@@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack | |||
631 | 631 | ||
632 | public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) | 632 | public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) |
633 | { | 633 | { |
634 | ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | 634 | ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); |
635 | reply.ChatData.Audible = 1; | 635 | reply.ChatData.Audible = 1; |
636 | reply.ChatData.Message = message; | 636 | reply.ChatData.Message = message; |
637 | reply.ChatData.ChatType = type; | 637 | reply.ChatData.ChatType = type; |
@@ -652,7 +652,7 @@ namespace OpenSim.Region.ClientStack | |||
652 | public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, | 652 | public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, |
653 | LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) | 653 | LLUUID imSessionID, string fromName, byte dialog, uint timeStamp) |
654 | { | 654 | { |
655 | ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); | 655 | ImprovedInstantMessagePacket msg = (ImprovedInstantMessagePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); |
656 | msg.AgentData.AgentID = fromAgent; | 656 | msg.AgentData.AgentID = fromAgent; |
657 | msg.AgentData.SessionID = fromAgentSession; | 657 | msg.AgentData.SessionID = fromAgentSession; |
658 | msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName); | 658 | msg.MessageBlock.FromAgentName = Helpers.StringToField(fromName); |
@@ -740,7 +740,8 @@ namespace OpenSim.Region.ClientStack | |||
740 | IPAddress neighbourIP = neighbourEndPoint.Address; | 740 | IPAddress neighbourIP = neighbourEndPoint.Address; |
741 | ushort neighbourPort = (ushort) neighbourEndPoint.Port; | 741 | ushort neighbourPort = (ushort) neighbourEndPoint.Port; |
742 | 742 | ||
743 | EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); | 743 | EnableSimulatorPacket enablesimpacket = (EnableSimulatorPacket) PacketPool.Instance.GetPacket(PacketType.EnableSimulator); |
744 | // TODO: don't create new blocks if recycling an old packet | ||
744 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); | 745 | enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); |
745 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; | 746 | enablesimpacket.SimulatorInfo.Handle = neighbourHandle; |
746 | 747 | ||
@@ -776,7 +777,8 @@ namespace OpenSim.Region.ClientStack | |||
776 | { | 777 | { |
777 | LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10); | 778 | LLVector3 look = new LLVector3(lookAt.X*10, lookAt.Y*10, lookAt.Z*10); |
778 | 779 | ||
779 | CrossedRegionPacket newSimPack = new CrossedRegionPacket(); | 780 | CrossedRegionPacket newSimPack = (CrossedRegionPacket) PacketPool.Instance.GetPacket(PacketType.CrossedRegion); |
781 | // TODO: don't create new blocks if recycling an old packet | ||
780 | newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); | 782 | newSimPack.AgentData = new CrossedRegionPacket.AgentDataBlock(); |
781 | newSimPack.AgentData.AgentID = AgentId; | 783 | newSimPack.AgentData.AgentID = AgentId; |
782 | newSimPack.AgentData.SessionID = m_sessionId; | 784 | newSimPack.AgentData.SessionID = m_sessionId; |
@@ -798,7 +800,8 @@ namespace OpenSim.Region.ClientStack | |||
798 | 800 | ||
799 | public void SendMapBlock(List<MapBlockData> mapBlocks) | 801 | public void SendMapBlock(List<MapBlockData> mapBlocks) |
800 | { | 802 | { |
801 | MapBlockReplyPacket mapReply = new MapBlockReplyPacket(); | 803 | MapBlockReplyPacket mapReply = (MapBlockReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapBlockReply); |
804 | // TODO: don't create new blocks if recycling an old packet | ||
802 | mapReply.AgentData.AgentID = AgentId; | 805 | mapReply.AgentData.AgentID = AgentId; |
803 | mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; | 806 | mapReply.Data = new MapBlockReplyPacket.DataBlock[mapBlocks.Count]; |
804 | mapReply.AgentData.Flags = 0; | 807 | mapReply.AgentData.Flags = 0; |
@@ -820,7 +823,7 @@ namespace OpenSim.Region.ClientStack | |||
820 | 823 | ||
821 | public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) | 824 | public void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags) |
822 | { | 825 | { |
823 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | 826 | TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal); |
824 | tpLocal.Info.AgentID = AgentId; | 827 | tpLocal.Info.AgentID = AgentId; |
825 | tpLocal.Info.TeleportFlags = flags; | 828 | tpLocal.Info.TeleportFlags = flags; |
826 | tpLocal.Info.LocationID = 2; | 829 | tpLocal.Info.LocationID = 2; |
@@ -832,7 +835,7 @@ namespace OpenSim.Region.ClientStack | |||
832 | public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, | 835 | public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, |
833 | uint flags, string capsURL) | 836 | uint flags, string capsURL) |
834 | { | 837 | { |
835 | TeleportFinishPacket teleport = new TeleportFinishPacket(); | 838 | TeleportFinishPacket teleport = (TeleportFinishPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFinish); |
836 | teleport.Info.AgentID = AgentId; | 839 | teleport.Info.AgentID = AgentId; |
837 | teleport.Info.RegionHandle = regionHandle; | 840 | teleport.Info.RegionHandle = regionHandle; |
838 | teleport.Info.SimAccess = simAccess; | 841 | teleport.Info.SimAccess = simAccess; |
@@ -858,7 +861,7 @@ namespace OpenSim.Region.ClientStack | |||
858 | /// </summary> | 861 | /// </summary> |
859 | public void SendTeleportFailed() | 862 | public void SendTeleportFailed() |
860 | { | 863 | { |
861 | TeleportFailedPacket tpFailed = new TeleportFailedPacket(); | 864 | TeleportFailedPacket tpFailed = (TeleportFailedPacket) PacketPool.Instance.GetPacket(PacketType.TeleportFailed); |
862 | tpFailed.Info.AgentID = AgentId; | 865 | tpFailed.Info.AgentID = AgentId; |
863 | tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport"); | 866 | tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport"); |
864 | OutPacket(tpFailed, ThrottleOutPacketType.Task); | 867 | OutPacket(tpFailed, ThrottleOutPacketType.Task); |
@@ -869,14 +872,14 @@ namespace OpenSim.Region.ClientStack | |||
869 | /// </summary> | 872 | /// </summary> |
870 | public void SendTeleportLocationStart() | 873 | public void SendTeleportLocationStart() |
871 | { | 874 | { |
872 | TeleportStartPacket tpStart = new TeleportStartPacket(); | 875 | TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart); |
873 | tpStart.Info.TeleportFlags = 16; // Teleport via location | 876 | tpStart.Info.TeleportFlags = 16; // Teleport via location |
874 | OutPacket(tpStart, ThrottleOutPacketType.Task); | 877 | OutPacket(tpStart, ThrottleOutPacketType.Task); |
875 | } | 878 | } |
876 | 879 | ||
877 | public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) | 880 | public void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance) |
878 | { | 881 | { |
879 | MoneyBalanceReplyPacket money = new MoneyBalanceReplyPacket(); | 882 | MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket) PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply); |
880 | money.MoneyData.AgentID = AgentId; | 883 | money.MoneyData.AgentID = AgentId; |
881 | money.MoneyData.TransactionID = transaction; | 884 | money.MoneyData.TransactionID = transaction; |
882 | money.MoneyData.TransactionSuccess = success; | 885 | money.MoneyData.TransactionSuccess = success; |
@@ -887,7 +890,7 @@ namespace OpenSim.Region.ClientStack | |||
887 | 890 | ||
888 | public void SendStartPingCheck(byte seq) | 891 | public void SendStartPingCheck(byte seq) |
889 | { | 892 | { |
890 | StartPingCheckPacket pc = new StartPingCheckPacket(); | 893 | StartPingCheckPacket pc = (StartPingCheckPacket) PacketPool.Instance.GetPacket(PacketType.StartPingCheck); |
891 | pc.PingID.PingID = seq; | 894 | pc.PingID.PingID = seq; |
892 | pc.Header.Reliable = false; | 895 | pc.Header.Reliable = false; |
893 | OutPacket(pc, ThrottleOutPacketType.Task); | 896 | OutPacket(pc, ThrottleOutPacketType.Task); |
@@ -895,7 +898,8 @@ namespace OpenSim.Region.ClientStack | |||
895 | 898 | ||
896 | public void SendKillObject(ulong regionHandle, uint localID) | 899 | public void SendKillObject(ulong regionHandle, uint localID) |
897 | { | 900 | { |
898 | KillObjectPacket kill = new KillObjectPacket(); | 901 | KillObjectPacket kill = (KillObjectPacket) PacketPool.Instance.GetPacket(PacketType.KillObject); |
902 | // TODO: don't create new blocks if recycling an old packet | ||
899 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | 903 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; |
900 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | 904 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); |
901 | kill.ObjectData[0].ID = localID; | 905 | kill.ObjectData[0].ID = localID; |
@@ -1088,7 +1092,7 @@ namespace OpenSim.Region.ClientStack | |||
1088 | 1092 | ||
1089 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) | 1093 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) |
1090 | { | 1094 | { |
1091 | InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); | 1095 | InventoryDescendentsPacket descend = (InventoryDescendentsPacket) PacketPool.Instance.GetPacket(PacketType.InventoryDescendents); |
1092 | descend.AgentData.AgentID = AgentId; | 1096 | descend.AgentData.AgentID = AgentId; |
1093 | descend.AgentData.OwnerID = ownerID; | 1097 | descend.AgentData.OwnerID = ownerID; |
1094 | descend.AgentData.FolderID = folderID; | 1098 | descend.AgentData.FolderID = folderID; |
@@ -1101,7 +1105,8 @@ namespace OpenSim.Region.ClientStack | |||
1101 | { | 1105 | { |
1102 | Encoding enc = Encoding.ASCII; | 1106 | Encoding enc = Encoding.ASCII; |
1103 | uint FULL_MASK_PERMISSIONS = 2147483647; | 1107 | uint FULL_MASK_PERMISSIONS = 2147483647; |
1104 | FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket(); | 1108 | FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket) PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply); |
1109 | // TODO: don't create new blocks if recycling an old packet | ||
1105 | inventoryReply.AgentData.AgentID = AgentId; | 1110 | inventoryReply.AgentData.AgentID = AgentId; |
1106 | inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; | 1111 | inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; |
1107 | inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); | 1112 | inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); |
@@ -1142,7 +1147,8 @@ namespace OpenSim.Region.ClientStack | |||
1142 | { | 1147 | { |
1143 | Encoding enc = Encoding.ASCII; | 1148 | Encoding enc = Encoding.ASCII; |
1144 | uint FULL_MASK_PERMISSIONS = 2147483647; | 1149 | uint FULL_MASK_PERMISSIONS = 2147483647; |
1145 | UpdateCreateInventoryItemPacket InventoryReply = new UpdateCreateInventoryItemPacket(); | 1150 | UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem); |
1151 | // TODO: don't create new blocks if recycling an old packet | ||
1146 | InventoryReply.AgentData.AgentID = AgentId; | 1152 | InventoryReply.AgentData.AgentID = AgentId; |
1147 | InventoryReply.AgentData.SimApproved = true; | 1153 | InventoryReply.AgentData.SimApproved = true; |
1148 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; | 1154 | InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; |
@@ -1180,7 +1186,8 @@ namespace OpenSim.Region.ClientStack | |||
1180 | 1186 | ||
1181 | public void SendRemoveInventoryItem(LLUUID itemID) | 1187 | public void SendRemoveInventoryItem(LLUUID itemID) |
1182 | { | 1188 | { |
1183 | RemoveInventoryItemPacket remove = new RemoveInventoryItemPacket(); | 1189 | RemoveInventoryItemPacket remove = (RemoveInventoryItemPacket) PacketPool.Instance.GetPacket(PacketType.RemoveInventoryItem); |
1190 | // TODO: don't create new blocks if recycling an old packet | ||
1184 | remove.AgentData.AgentID = AgentId; | 1191 | remove.AgentData.AgentID = AgentId; |
1185 | remove.AgentData.SessionID = m_sessionId; | 1192 | remove.AgentData.SessionID = m_sessionId; |
1186 | remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; | 1193 | remove.InventoryData = new RemoveInventoryItemPacket.InventoryDataBlock[1]; |
@@ -1192,7 +1199,7 @@ namespace OpenSim.Region.ClientStack | |||
1192 | 1199 | ||
1193 | public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) | 1200 | public void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName) |
1194 | { | 1201 | { |
1195 | ReplyTaskInventoryPacket replytask = new ReplyTaskInventoryPacket(); | 1202 | ReplyTaskInventoryPacket replytask = (ReplyTaskInventoryPacket) PacketPool.Instance.GetPacket(PacketType.ReplyTaskInventory); |
1196 | replytask.InventoryData.TaskID = taskID; | 1203 | replytask.InventoryData.TaskID = taskID; |
1197 | replytask.InventoryData.Serial = serial; | 1204 | replytask.InventoryData.Serial = serial; |
1198 | replytask.InventoryData.Filename = fileName; | 1205 | replytask.InventoryData.Filename = fileName; |
@@ -1201,7 +1208,7 @@ namespace OpenSim.Region.ClientStack | |||
1201 | 1208 | ||
1202 | public void SendXferPacket(ulong xferID, uint packet, byte[] data) | 1209 | public void SendXferPacket(ulong xferID, uint packet, byte[] data) |
1203 | { | 1210 | { |
1204 | SendXferPacketPacket sendXfer = new SendXferPacketPacket(); | 1211 | SendXferPacketPacket sendXfer = (SendXferPacketPacket) PacketPool.Instance.GetPacket(PacketType.SendXferPacket); |
1205 | sendXfer.XferID.ID = xferID; | 1212 | sendXfer.XferID.ID = xferID; |
1206 | sendXfer.XferID.Packet = packet; | 1213 | sendXfer.XferID.Packet = packet; |
1207 | sendXfer.DataPacket.Data = data; | 1214 | sendXfer.DataPacket.Data = data; |
@@ -1219,7 +1226,7 @@ namespace OpenSim.Region.ClientStack | |||
1219 | /// <param name="message"></param> | 1226 | /// <param name="message"></param> |
1220 | public void SendAlertMessage(string message) | 1227 | public void SendAlertMessage(string message) |
1221 | { | 1228 | { |
1222 | AlertMessagePacket alertPack = new AlertMessagePacket(); | 1229 | AlertMessagePacket alertPack = (AlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AlertMessage); |
1223 | alertPack.AlertData.Message = Helpers.StringToField(message); | 1230 | alertPack.AlertData.Message = Helpers.StringToField(message); |
1224 | OutPacket(alertPack, ThrottleOutPacketType.Task); | 1231 | OutPacket(alertPack, ThrottleOutPacketType.Task); |
1225 | } | 1232 | } |
@@ -1231,7 +1238,7 @@ namespace OpenSim.Region.ClientStack | |||
1231 | /// <param name="modal"></param> | 1238 | /// <param name="modal"></param> |
1232 | public void SendAgentAlertMessage(string message, bool modal) | 1239 | public void SendAgentAlertMessage(string message, bool modal) |
1233 | { | 1240 | { |
1234 | AgentAlertMessagePacket alertPack = new AgentAlertMessagePacket(); | 1241 | AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket) PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage); |
1235 | alertPack.AgentData.AgentID = AgentId; | 1242 | alertPack.AgentData.AgentID = AgentId; |
1236 | alertPack.AlertData.Message = Helpers.StringToField(message); | 1243 | alertPack.AlertData.Message = Helpers.StringToField(message); |
1237 | alertPack.AlertData.Modal = modal; | 1244 | alertPack.AlertData.Modal = modal; |
@@ -1241,7 +1248,7 @@ namespace OpenSim.Region.ClientStack | |||
1241 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, | 1248 | public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, |
1242 | string url) | 1249 | string url) |
1243 | { | 1250 | { |
1244 | LoadURLPacket loadURL = new LoadURLPacket(); | 1251 | LoadURLPacket loadURL = (LoadURLPacket) PacketPool.Instance.GetPacket(PacketType.LoadURL); |
1245 | loadURL.Data.ObjectName = Helpers.StringToField(objectname); | 1252 | loadURL.Data.ObjectName = Helpers.StringToField(objectname); |
1246 | loadURL.Data.ObjectID = objectID; | 1253 | loadURL.Data.ObjectID = objectID; |
1247 | loadURL.Data.OwnerID = ownerID; | 1254 | loadURL.Data.OwnerID = ownerID; |
@@ -1255,7 +1262,8 @@ namespace OpenSim.Region.ClientStack | |||
1255 | 1262 | ||
1256 | public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) | 1263 | public void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID) |
1257 | { | 1264 | { |
1258 | PreloadSoundPacket preSound = new PreloadSoundPacket(); | 1265 | PreloadSoundPacket preSound = (PreloadSoundPacket) PacketPool.Instance.GetPacket(PacketType.PreloadSound); |
1266 | // TODO: don't create new blocks if recycling an old packet | ||
1259 | preSound.DataBlock = new PreloadSoundPacket.DataBlockBlock[1]; | 1267 | preSound.DataBlock = new PreloadSoundPacket.DataBlockBlock[1]; |
1260 | preSound.DataBlock[0] = new PreloadSoundPacket.DataBlockBlock(); | 1268 | preSound.DataBlock[0] = new PreloadSoundPacket.DataBlockBlock(); |
1261 | preSound.DataBlock[0].ObjectID = objectID; | 1269 | preSound.DataBlock[0].ObjectID = objectID; |
@@ -1266,7 +1274,7 @@ namespace OpenSim.Region.ClientStack | |||
1266 | 1274 | ||
1267 | public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) | 1275 | public void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags) |
1268 | { | 1276 | { |
1269 | AttachedSoundPacket sound = new AttachedSoundPacket(); | 1277 | AttachedSoundPacket sound = (AttachedSoundPacket) PacketPool.Instance.GetPacket(PacketType.AttachedSound); |
1270 | sound.DataBlock.SoundID = soundID; | 1278 | sound.DataBlock.SoundID = soundID; |
1271 | sound.DataBlock.ObjectID = objectID; | 1279 | sound.DataBlock.ObjectID = objectID; |
1272 | sound.DataBlock.OwnerID = ownerID; | 1280 | sound.DataBlock.OwnerID = ownerID; |
@@ -1278,7 +1286,7 @@ namespace OpenSim.Region.ClientStack | |||
1278 | 1286 | ||
1279 | public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) | 1287 | public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) |
1280 | { | 1288 | { |
1281 | SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); | 1289 | SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); |
1282 | viewertime.TimeInfo.SunDirection = sunPos; | 1290 | viewertime.TimeInfo.SunDirection = sunPos; |
1283 | viewertime.TimeInfo.SunAngVelocity = sunVel; | 1291 | viewertime.TimeInfo.SunAngVelocity = sunVel; |
1284 | viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); | 1292 | viewertime.TimeInfo.UsecSinceStart = (ulong) Util.UnixTimeSinceEpoch(); |
@@ -1288,7 +1296,7 @@ namespace OpenSim.Region.ClientStack | |||
1288 | public void SendViewerTime(int phase) | 1296 | public void SendViewerTime(int phase) |
1289 | { | 1297 | { |
1290 | Console.WriteLine("SunPhase: {0}", phase); | 1298 | Console.WriteLine("SunPhase: {0}", phase); |
1291 | SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); | 1299 | SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket) PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); |
1292 | //viewertime.TimeInfo.SecPerDay = 86400; | 1300 | //viewertime.TimeInfo.SecPerDay = 86400; |
1293 | //viewertime.TimeInfo.SecPerYear = 31536000; | 1301 | //viewertime.TimeInfo.SecPerYear = 31536000; |
1294 | viewertime.TimeInfo.SecPerDay = 1000; | 1302 | viewertime.TimeInfo.SecPerDay = 1000; |
@@ -1337,7 +1345,7 @@ namespace OpenSim.Region.ClientStack | |||
1337 | string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, | 1345 | string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, |
1338 | LLUUID partnerID) | 1346 | LLUUID partnerID) |
1339 | { | 1347 | { |
1340 | AvatarPropertiesReplyPacket avatarReply = new AvatarPropertiesReplyPacket(); | 1348 | AvatarPropertiesReplyPacket avatarReply = (AvatarPropertiesReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPropertiesReply); |
1341 | avatarReply.AgentData.AgentID = AgentId; | 1349 | avatarReply.AgentData.AgentID = AgentId; |
1342 | avatarReply.AgentData.AvatarID = avatarID; | 1350 | avatarReply.AgentData.AvatarID = avatarID; |
1343 | avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); | 1351 | avatarReply.PropertiesData.AboutText = Helpers.StringToField(aboutText); |
@@ -1362,11 +1370,12 @@ namespace OpenSim.Region.ClientStack | |||
1362 | /// <param name="wearables"></param> | 1370 | /// <param name="wearables"></param> |
1363 | public void SendWearables(AvatarWearable[] wearables, int serial) | 1371 | public void SendWearables(AvatarWearable[] wearables, int serial) |
1364 | { | 1372 | { |
1365 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | 1373 | AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket) PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate); |
1366 | aw.AgentData.AgentID = AgentId; | 1374 | aw.AgentData.AgentID = AgentId; |
1367 | aw.AgentData.SerialNum = (uint) serial; | 1375 | aw.AgentData.SerialNum = (uint) serial; |
1368 | aw.AgentData.SessionID = m_sessionId; | 1376 | aw.AgentData.SessionID = m_sessionId; |
1369 | 1377 | ||
1378 | // TODO: don't create new blocks if recycling an old packet | ||
1370 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | 1379 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; |
1371 | AgentWearablesUpdatePacket.WearableDataBlock awb; | 1380 | AgentWearablesUpdatePacket.WearableDataBlock awb; |
1372 | for (int i = 0; i < wearables.Length; i++) | 1381 | for (int i = 0; i < wearables.Length; i++) |
@@ -1389,7 +1398,8 @@ namespace OpenSim.Region.ClientStack | |||
1389 | /// <param name="textureEntry"></param> | 1398 | /// <param name="textureEntry"></param> |
1390 | public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) | 1399 | public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) |
1391 | { | 1400 | { |
1392 | AvatarAppearancePacket avp = new AvatarAppearancePacket(); | 1401 | AvatarAppearancePacket avp = (AvatarAppearancePacket) PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); |
1402 | // TODO: don't create new blocks if recycling an old packet | ||
1393 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; | 1403 | avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; |
1394 | avp.ObjectData.TextureEntry = textureEntry; | 1404 | avp.ObjectData.TextureEntry = textureEntry; |
1395 | 1405 | ||
@@ -1408,7 +1418,8 @@ namespace OpenSim.Region.ClientStack | |||
1408 | 1418 | ||
1409 | public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId) | 1419 | public void SendAnimations(LLUUID[] animations, int[] seqs, LLUUID sourceAgentId) |
1410 | { | 1420 | { |
1411 | AvatarAnimationPacket ani = new AvatarAnimationPacket(); | 1421 | AvatarAnimationPacket ani = (AvatarAnimationPacket) PacketPool.Instance.GetPacket(PacketType.AvatarAnimation); |
1422 | // TODO: don't create new blocks if recycling an old packet | ||
1412 | ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; | 1423 | ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; |
1413 | ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); | 1424 | ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); |
1414 | ani.AnimationSourceList[0].ObjectID = sourceAgentId; | 1425 | ani.AnimationSourceList[0].ObjectID = sourceAgentId; |
@@ -1442,7 +1453,8 @@ namespace OpenSim.Region.ClientStack | |||
1442 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, | 1453 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, |
1443 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | 1454 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) |
1444 | { | 1455 | { |
1445 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | 1456 | ObjectUpdatePacket objupdate = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
1457 | // TODO: don't create new blocks if recycling an old packet | ||
1446 | objupdate.RegionData.RegionHandle = regionHandle; | 1458 | objupdate.RegionData.RegionHandle = regionHandle; |
1447 | objupdate.RegionData.TimeDilation = 64096; | 1459 | objupdate.RegionData.TimeDilation = 64096; |
1448 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 1460 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
@@ -1474,7 +1486,8 @@ namespace OpenSim.Region.ClientStack | |||
1474 | { | 1486 | { |
1475 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = | 1487 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = |
1476 | CreateAvatarImprovedBlock(localID, position, velocity, rotation); | 1488 | CreateAvatarImprovedBlock(localID, position, velocity, rotation); |
1477 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 1489 | ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
1490 | // TODO: don't create new blocks if recycling an old packet | ||
1478 | terse.RegionData.RegionHandle = regionHandle; | 1491 | terse.RegionData.RegionHandle = regionHandle; |
1479 | terse.RegionData.TimeDilation = timeDilation; | 1492 | terse.RegionData.TimeDilation = timeDilation; |
1480 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1493 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
@@ -1485,7 +1498,8 @@ namespace OpenSim.Region.ClientStack | |||
1485 | 1498 | ||
1486 | public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) | 1499 | public void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations) |
1487 | { | 1500 | { |
1488 | CoarseLocationUpdatePacket loc = new CoarseLocationUpdatePacket(); | 1501 | CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket) PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); |
1502 | // TODO: don't create new blocks if recycling an old packet | ||
1489 | int total = CoarseLocations.Count; | 1503 | int total = CoarseLocations.Count; |
1490 | CoarseLocationUpdatePacket.IndexBlock ib = | 1504 | CoarseLocationUpdatePacket.IndexBlock ib = |
1491 | new CoarseLocationUpdatePacket.IndexBlock(); | 1505 | new CoarseLocationUpdatePacket.IndexBlock(); |
@@ -1517,7 +1531,8 @@ namespace OpenSim.Region.ClientStack | |||
1517 | /// <param name="attachPoint"></param> | 1531 | /// <param name="attachPoint"></param> |
1518 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) | 1532 | public void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) |
1519 | { | 1533 | { |
1520 | ObjectAttachPacket attach = new ObjectAttachPacket(); | 1534 | ObjectAttachPacket attach = (ObjectAttachPacket) PacketPool.Instance.GetPacket(PacketType.ObjectAttach); |
1535 | // TODO: don't create new blocks if recycling an old packet | ||
1521 | attach.AgentData.AgentID = AgentId; | 1536 | attach.AgentData.AgentID = AgentId; |
1522 | attach.AgentData.SessionID = m_sessionId; | 1537 | attach.AgentData.SessionID = m_sessionId; |
1523 | attach.AgentData.AttachmentPoint = attachPoint; | 1538 | attach.AgentData.AttachmentPoint = attachPoint; |
@@ -1536,7 +1551,8 @@ namespace OpenSim.Region.ClientStack | |||
1536 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, | 1551 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, |
1537 | LLQuaternion rotation, byte clickAction) | 1552 | LLQuaternion rotation, byte clickAction) |
1538 | { | 1553 | { |
1539 | ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); | 1554 | ObjectUpdatePacket outPacket = (ObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
1555 | // TODO: don't create new blocks if recycling an old packet | ||
1540 | outPacket.RegionData.RegionHandle = regionHandle; | 1556 | outPacket.RegionData.RegionHandle = regionHandle; |
1541 | outPacket.RegionData.TimeDilation = timeDilation; | 1557 | outPacket.RegionData.TimeDilation = timeDilation; |
1542 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 1558 | outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
@@ -1579,7 +1595,8 @@ namespace OpenSim.Region.ClientStack | |||
1579 | { | 1595 | { |
1580 | LLVector3 velocity = new LLVector3(0f, 0f, 0f); | 1596 | LLVector3 velocity = new LLVector3(0f, 0f, 0f); |
1581 | LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f); | 1597 | LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f); |
1582 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 1598 | ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
1599 | // TODO: don't create new blocks if recycling an old packet | ||
1583 | terse.RegionData.RegionHandle = regionHandle; | 1600 | terse.RegionData.RegionHandle = regionHandle; |
1584 | terse.RegionData.TimeDilation = timeDilation; | 1601 | terse.RegionData.TimeDilation = timeDilation; |
1585 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1602 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
@@ -1591,7 +1608,8 @@ namespace OpenSim.Region.ClientStack | |||
1591 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | 1608 | public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
1592 | LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity) | 1609 | LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity) |
1593 | { | 1610 | { |
1594 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | 1611 | ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket) PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); |
1612 | // TODO: don't create new blocks if recycling an old packet | ||
1595 | terse.RegionData.RegionHandle = regionHandle; | 1613 | terse.RegionData.RegionHandle = regionHandle; |
1596 | terse.RegionData.TimeDilation = timeDilation; | 1614 | terse.RegionData.TimeDilation = timeDilation; |
1597 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | 1615 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; |
@@ -1928,8 +1946,8 @@ namespace OpenSim.Region.ClientStack | |||
1928 | 1946 | ||
1929 | public void SendNameReply(LLUUID profileId, string firstname, string lastname) | 1947 | public void SendNameReply(LLUUID profileId, string firstname, string lastname) |
1930 | { | 1948 | { |
1931 | UUIDNameReplyPacket packet = new UUIDNameReplyPacket(); | 1949 | UUIDNameReplyPacket packet = (UUIDNameReplyPacket) PacketPool.Instance.GetPacket(PacketType.UUIDNameReply); |
1932 | 1950 | // TODO: don't create new blocks if recycling an old packet | |
1933 | packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; | 1951 | packet.UUIDNameBlock = new UUIDNameReplyPacket.UUIDNameBlockBlock[1]; |
1934 | packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); | 1952 | packet.UUIDNameBlock[0] = new UUIDNameReplyPacket.UUIDNameBlockBlock(); |
1935 | packet.UUIDNameBlock[0].ID = profileId; | 1953 | packet.UUIDNameBlock[0].ID = profileId; |
@@ -1977,7 +1995,8 @@ namespace OpenSim.Region.ClientStack | |||
1977 | { | 1995 | { |
1978 | //System.Console.WriteLine("texture cached: " + packet.ToString()); | 1996 | //System.Console.WriteLine("texture cached: " + packet.ToString()); |
1979 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet; | 1997 | AgentCachedTexturePacket chechedtex = (AgentCachedTexturePacket) packet; |
1980 | AgentCachedTextureResponsePacket cachedresp = new AgentCachedTextureResponsePacket(); | 1998 | AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket) PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); |
1999 | // TODO: don't create new blocks if recycling an old packet | ||
1981 | cachedresp.AgentData.AgentID = AgentId; | 2000 | cachedresp.AgentData.AgentID = AgentId; |
1982 | cachedresp.AgentData.SessionID = m_sessionId; | 2001 | cachedresp.AgentData.SessionID = m_sessionId; |
1983 | cachedresp.AgentData.SerialNum = m_cachedTextureSerial; | 2002 | cachedresp.AgentData.SerialNum = m_cachedTextureSerial; |
@@ -2137,7 +2156,8 @@ namespace OpenSim.Region.ClientStack | |||
2137 | { | 2156 | { |
2138 | //should be getting the map layer from the grid server | 2157 | //should be getting the map layer from the grid server |
2139 | //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) | 2158 | //send a layer covering the 800,800 - 1200,1200 area (should be covering the requested area) |
2140 | MapLayerReplyPacket mapReply = new MapLayerReplyPacket(); | 2159 | MapLayerReplyPacket mapReply = (MapLayerReplyPacket) PacketPool.Instance.GetPacket(PacketType.MapLayerReply); |
2160 | // TODO: don't create new blocks if recycling an old packet | ||
2141 | mapReply.AgentData.AgentID = AgentId; | 2161 | mapReply.AgentData.AgentID = AgentId; |
2142 | mapReply.AgentData.Flags = 0; | 2162 | mapReply.AgentData.Flags = 0; |
2143 | mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; | 2163 | mapReply.LayerData = new MapLayerReplyPacket.LayerDataBlock[1]; |
@@ -2281,22 +2301,18 @@ namespace OpenSim.Region.ClientStack | |||
2281 | // Actually make the byte array and send it | 2301 | // Actually make the byte array and send it |
2282 | try | 2302 | try |
2283 | { | 2303 | { |
2284 | byte[] sendbuffer = Pack.ToBytes(); | 2304 | byte[] sendbuffer = Pack.ToBytes(); |
2285 | if (Pack is RegionHandshakePacket) | 2305 | PacketPool.Instance.ReturnPacket(Pack); |
2286 | { | 2306 | |
2287 | PacketPool.Instance.ReturnPacket(Pack); | 2307 | if (Pack.Header.Zerocoded) |
2288 | } | 2308 | { |
2289 | 2309 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); | |
2290 | if (Pack.Header.Zerocoded) | 2310 | m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); |
2291 | { | 2311 | } |
2292 | byte[] ZeroOutBuffer = new byte[4096]; | 2312 | else |
2293 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); | 2313 | { |
2294 | m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); | 2314 | m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); |
2295 | } | 2315 | } |
2296 | else | ||
2297 | { | ||
2298 | m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); | ||
2299 | } | ||
2300 | } | 2316 | } |
2301 | catch (Exception e) | 2317 | catch (Exception e) |
2302 | { | 2318 | { |
@@ -2342,7 +2358,7 @@ namespace OpenSim.Region.ClientStack | |||
2342 | { | 2358 | { |
2343 | //reply to pingcheck | 2359 | //reply to pingcheck |
2344 | StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack; | 2360 | StartPingCheckPacket startPing = (StartPingCheckPacket) NewPack; |
2345 | CompletePingCheckPacket endPing = new CompletePingCheckPacket(); | 2361 | CompletePingCheckPacket endPing = (CompletePingCheckPacket) PacketPool.Instance.GetPacket(PacketType.CompletePingCheck); |
2346 | endPing.PingID.PingID = startPing.PingID.PingID; | 2362 | endPing.PingID.PingID = startPing.PingID.PingID; |
2347 | OutPacket(endPing, ThrottleOutPacketType.Task); | 2363 | OutPacket(endPing, ThrottleOutPacketType.Task); |
2348 | } | 2364 | } |
@@ -2371,7 +2387,8 @@ namespace OpenSim.Region.ClientStack | |||
2371 | { | 2387 | { |
2372 | if (Pack.Header.Reliable) | 2388 | if (Pack.Header.Reliable) |
2373 | { | 2389 | { |
2374 | PacketAckPacket ack_it = new PacketAckPacket(); | 2390 | PacketAckPacket ack_it = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck); |
2391 | // TODO: don't create new blocks if recycling an old packet | ||
2375 | ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; | 2392 | ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; |
2376 | ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); | 2393 | ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); |
2377 | ack_it.Packets[0].ID = Pack.Header.Sequence; | 2394 | ack_it.Packets[0].ID = Pack.Header.Sequence; |
@@ -2426,7 +2443,8 @@ namespace OpenSim.Region.ClientStack | |||
2426 | //MainLog.Instance.Verbose("NETWORK", "Sending PacketAck"); | 2443 | //MainLog.Instance.Verbose("NETWORK", "Sending PacketAck"); |
2427 | 2444 | ||
2428 | int i = 0; | 2445 | int i = 0; |
2429 | PacketAckPacket acks = new PacketAckPacket(); | 2446 | PacketAckPacket acks = (PacketAckPacket) PacketPool.Instance.GetPacket(PacketType.PacketAck); |
2447 | // TODO: don't create new blocks if recycling an old packet | ||
2430 | acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count]; | 2448 | acks.Packets = new PacketAckPacket.PacketsBlock[m_pendingAcks.Count]; |
2431 | 2449 | ||
2432 | foreach (uint ack in m_pendingAcks.Values) | 2450 | foreach (uint ack in m_pendingAcks.Values) |
@@ -2850,10 +2868,9 @@ namespace OpenSim.Region.ClientStack | |||
2850 | break; | 2868 | break; |
2851 | case PacketType.ObjectPermissions: | 2869 | case PacketType.ObjectPermissions: |
2852 | MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString()); | 2870 | MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString()); |
2853 | ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket) Pack; | 2871 | ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack; |
2854 | 2872 | ||
2855 | List<ObjectPermissionsPacket.ObjectDataBlock> permChanges = | 2873 | List<ObjectPermissionsPacket.ObjectDataBlock> permChanges = new List<ObjectPermissionsPacket.ObjectDataBlock>(); |
2856 | new List<ObjectPermissionsPacket.ObjectDataBlock>(); | ||
2857 | 2874 | ||
2858 | for (int i = 0; i < newobjPerms.ObjectData.Length; i++) | 2875 | for (int i = 0; i < newobjPerms.ObjectData.Length; i++) |
2859 | { | 2876 | { |
@@ -2883,7 +2900,7 @@ namespace OpenSim.Region.ClientStack | |||
2883 | 2900 | ||
2884 | case PacketType.RequestObjectPropertiesFamily: | 2901 | case PacketType.RequestObjectPropertiesFamily: |
2885 | //This powers the little tooltip that appears when you move your mouse over an object | 2902 | //This powers the little tooltip that appears when you move your mouse over an object |
2886 | RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket) Pack; | 2903 | RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; |
2887 | 2904 | ||
2888 | 2905 | ||
2889 | RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData; | 2906 | RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData; |
@@ -2987,7 +3004,7 @@ namespace OpenSim.Region.ClientStack | |||
2987 | case PacketType.MoveInventoryFolder: | 3004 | case PacketType.MoveInventoryFolder: |
2988 | if (OnMoveInventoryFolder != null) | 3005 | if (OnMoveInventoryFolder != null) |
2989 | { | 3006 | { |
2990 | MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket) Pack; | 3007 | MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket)Pack; |
2991 | for (int i = 0; i < invFolder.InventoryData.Length; i++) | 3008 | for (int i = 0; i < invFolder.InventoryData.Length; i++) |
2992 | { | 3009 | { |
2993 | OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID, | 3010 | OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID, |
@@ -3094,7 +3111,7 @@ namespace OpenSim.Region.ClientStack | |||
3094 | } | 3111 | } |
3095 | break; | 3112 | break; |
3096 | case PacketType.MoveInventoryItem: | 3113 | case PacketType.MoveInventoryItem: |
3097 | MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket) Pack; | 3114 | MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack; |
3098 | if (OnMoveInventoryItem != null) | 3115 | if (OnMoveInventoryItem != null) |
3099 | { | 3116 | { |
3100 | foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) | 3117 | foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) |
@@ -3163,11 +3180,11 @@ namespace OpenSim.Region.ClientStack | |||
3163 | case PacketType.TeleportLandmarkRequest: | 3180 | case PacketType.TeleportLandmarkRequest: |
3164 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack; | 3181 | TeleportLandmarkRequestPacket tpReq = (TeleportLandmarkRequestPacket) Pack; |
3165 | 3182 | ||
3166 | TeleportStartPacket tpStart = new TeleportStartPacket(); | 3183 | TeleportStartPacket tpStart = (TeleportStartPacket) PacketPool.Instance.GetPacket(PacketType.TeleportStart); |
3167 | tpStart.Info.TeleportFlags = 8; // tp via lm | 3184 | tpStart.Info.TeleportFlags = 8; // tp via lm |
3168 | OutPacket(tpStart, ThrottleOutPacketType.Task); | 3185 | OutPacket(tpStart, ThrottleOutPacketType.Task); |
3169 | 3186 | ||
3170 | TeleportProgressPacket tpProgress = new TeleportProgressPacket(); | 3187 | TeleportProgressPacket tpProgress = (TeleportProgressPacket) PacketPool.Instance.GetPacket(PacketType.TeleportProgress); |
3171 | tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); | 3188 | tpProgress.Info.Message = (new ASCIIEncoding()).GetBytes("sending_landmark"); |
3172 | tpProgress.Info.TeleportFlags = 8; | 3189 | tpProgress.Info.TeleportFlags = 8; |
3173 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; | 3190 | tpProgress.AgentData.AgentID = tpReq.Info.AgentID; |
@@ -3182,7 +3199,7 @@ namespace OpenSim.Region.ClientStack | |||
3182 | 3199 | ||
3183 | if (lm.RegionID == m_scene.RegionInfo.RegionID) | 3200 | if (lm.RegionID == m_scene.RegionInfo.RegionID) |
3184 | { | 3201 | { |
3185 | TeleportLocalPacket tpLocal = new TeleportLocalPacket(); | 3202 | TeleportLocalPacket tpLocal = (TeleportLocalPacket) PacketPool.Instance.GetPacket(PacketType.TeleportLocal); |
3186 | 3203 | ||
3187 | tpLocal.Info.AgentID = tpReq.Info.AgentID; | 3204 | tpLocal.Info.AgentID = tpReq.Info.AgentID; |
3188 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark | 3205 | tpLocal.Info.TeleportFlags = 8; // Teleport via landmark |
@@ -3192,7 +3209,7 @@ namespace OpenSim.Region.ClientStack | |||
3192 | } | 3209 | } |
3193 | else | 3210 | else |
3194 | { | 3211 | { |
3195 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | 3212 | TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel); |
3196 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | 3213 | tpCancel.Info.AgentID = tpReq.Info.AgentID; |
3197 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | 3214 | tpCancel.Info.SessionID = tpReq.Info.SessionID; |
3198 | OutPacket(tpCancel, ThrottleOutPacketType.Task); | 3215 | OutPacket(tpCancel, ThrottleOutPacketType.Task); |
@@ -3202,7 +3219,7 @@ namespace OpenSim.Region.ClientStack | |||
3202 | { | 3219 | { |
3203 | Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); | 3220 | Console.WriteLine("Cancelling Teleport - fetch asset not yet implemented"); |
3204 | 3221 | ||
3205 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | 3222 | TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel); |
3206 | tpCancel.Info.AgentID = tpReq.Info.AgentID; | 3223 | tpCancel.Info.AgentID = tpReq.Info.AgentID; |
3207 | tpCancel.Info.SessionID = tpReq.Info.SessionID; | 3224 | tpCancel.Info.SessionID = tpReq.Info.SessionID; |
3208 | OutPacket(tpCancel, ThrottleOutPacketType.Task); | 3225 | OutPacket(tpCancel, ThrottleOutPacketType.Task); |
@@ -3220,7 +3237,7 @@ namespace OpenSim.Region.ClientStack | |||
3220 | else | 3237 | else |
3221 | { | 3238 | { |
3222 | //no event handler so cancel request | 3239 | //no event handler so cancel request |
3223 | TeleportCancelPacket tpCancel = new TeleportCancelPacket(); | 3240 | TeleportCancelPacket tpCancel = (TeleportCancelPacket) PacketPool.Instance.GetPacket(PacketType.TeleportCancel); |
3224 | tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; | 3241 | tpCancel.Info.SessionID = tpLocReq.AgentData.SessionID; |
3225 | tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; | 3242 | tpCancel.Info.AgentID = tpLocReq.AgentData.AgentID; |
3226 | OutPacket(tpCancel, ThrottleOutPacketType.Task); | 3243 | OutPacket(tpCancel, ThrottleOutPacketType.Task); |
@@ -3521,13 +3538,15 @@ namespace OpenSim.Region.ClientStack | |||
3521 | shape.PathTwist = addPacket.ObjectData.PathTwist; | 3538 | shape.PathTwist = addPacket.ObjectData.PathTwist; |
3522 | shape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; | 3539 | shape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; |
3523 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("89556747-24cb-43ed-920b-47caed15465f")); | 3540 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("89556747-24cb-43ed-920b-47caed15465f")); |
3524 | shape.Textures = ntex; | 3541 | shape.TextureEntry = ntex.ToBytes(); |
3542 | //shape.Textures = ntex; | ||
3525 | return shape; | 3543 | return shape; |
3526 | } | 3544 | } |
3527 | 3545 | ||
3528 | public void SendLogoutPacket() | 3546 | public void SendLogoutPacket() |
3529 | { | 3547 | { |
3530 | LogoutReplyPacket logReply = new LogoutReplyPacket(); | 3548 | LogoutReplyPacket logReply = (LogoutReplyPacket) PacketPool.Instance.GetPacket(PacketType.LogoutReply); |
3549 | // TODO: don't create new blocks if recycling an old packet | ||
3531 | logReply.AgentData.AgentID = AgentId; | 3550 | logReply.AgentData.AgentID = AgentId; |
3532 | logReply.AgentData.SessionID = SessionId; | 3551 | logReply.AgentData.SessionID = SessionId; |
3533 | logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1]; | 3552 | logReply.InventoryData = new LogoutReplyPacket.InventoryDataBlock[1]; |
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 10435bf..bcbd81a 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs | |||
@@ -30,7 +30,6 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Net.Sockets; | 32 | using System.Net.Sockets; |
33 | using libsecondlife; | ||
34 | using libsecondlife.Packets; | 33 | using libsecondlife.Packets; |
35 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
@@ -38,103 +37,6 @@ using OpenSim.Framework.Console; | |||
38 | 37 | ||
39 | namespace OpenSim.Region.ClientStack | 38 | namespace OpenSim.Region.ClientStack |
40 | { | 39 | { |
41 | public sealed class PacketPool | ||
42 | { | ||
43 | // Set up a thread-safe singleton pattern | ||
44 | static PacketPool() | ||
45 | { | ||
46 | } | ||
47 | |||
48 | private static readonly PacketPool instance = new PacketPool(); | ||
49 | |||
50 | public static PacketPool Instance | ||
51 | { | ||
52 | get { return instance; } | ||
53 | } | ||
54 | |||
55 | private Hashtable pool = new Hashtable(); | ||
56 | |||
57 | public Packet GetPacket(PacketType type) | ||
58 | { | ||
59 | Packet packet = null; | ||
60 | |||
61 | lock (pool) | ||
62 | { | ||
63 | if (pool[type] == null || ((Stack) pool[type]).Count == 0) | ||
64 | { | ||
65 | // Creating a new packet if we cannot reuse an old package | ||
66 | packet = Packet.BuildPacket(type); | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | // Recycle old packages | ||
71 | packet = (Packet) ((Stack) pool[type]).Pop(); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | return packet; | ||
76 | } | ||
77 | |||
78 | public Packet GetPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer) | ||
79 | { | ||
80 | Packet packet = GetPacket(GetType(bytes, packetEnd, zeroBuffer)); | ||
81 | |||
82 | int i = 0; | ||
83 | packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); | ||
84 | return packet; | ||
85 | } | ||
86 | |||
87 | public PacketType GetType(byte[] bytes, int packetEnd, byte[] zeroBuffer) | ||
88 | { | ||
89 | //Function removed from LibSL revision 1540 | ||
90 | // We're using it.. so Built it into UDP server for now.. | ||
91 | ushort id; | ||
92 | PacketFrequency freq; | ||
93 | int i = 0, end = packetEnd; | ||
94 | Header header = Header.BuildHeader(bytes, ref i, ref end); | ||
95 | if (header.Zerocoded) | ||
96 | { | ||
97 | end = Helpers.ZeroDecode(bytes, end + 1, zeroBuffer) - 1; | ||
98 | bytes = zeroBuffer; | ||
99 | } | ||
100 | |||
101 | if (bytes[6] == 0xFF) | ||
102 | { | ||
103 | if (bytes[7] == 0xFF) | ||
104 | { | ||
105 | id = (ushort) ((bytes[8] << 8) + bytes[9]); | ||
106 | freq = PacketFrequency.Low; | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | id = (ushort) bytes[7]; | ||
111 | freq = PacketFrequency.Medium; | ||
112 | } | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | id = (ushort) bytes[6]; | ||
117 | freq = PacketFrequency.High; | ||
118 | } | ||
119 | return Packet.GetType(id, freq); | ||
120 | } | ||
121 | |||
122 | public void ReturnPacket(Packet packet) | ||
123 | { | ||
124 | lock (pool) | ||
125 | { | ||
126 | PacketType type = packet.Type; | ||
127 | |||
128 | if (pool[type] == null) | ||
129 | { | ||
130 | pool[type] = new Stack(); | ||
131 | } | ||
132 | |||
133 | ((Stack) pool[type]).Push(packet); | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | |||
138 | public class UDPServer : ClientStackNetworkHandler | 40 | public class UDPServer : ClientStackNetworkHandler |
139 | { | 41 | { |
140 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); | 42 | protected Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); |
@@ -386,4 +288,4 @@ namespace OpenSim.Region.ClientStack | |||
386 | } | 288 | } |
387 | } | 289 | } |
388 | } | 290 | } |
389 | } \ No newline at end of file | 291 | } |
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; | |||
32 | using libsecondlife.Packets; | 32 | using libsecondlife.Packets; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Environment.Scenes; | 34 | using OpenSim.Region.Environment.Scenes; |
35 | using OpenSim.Region.Environment.Interfaces; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.Environment.LandManagement | 37 | namespace OpenSim.Region.Environment.LandManagement |
37 | { | 38 | { |
@@ -110,7 +111,9 @@ namespace OpenSim.Region.Environment.LandManagement | |||
110 | 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, |
111 | IClientAPI remote_client) | 112 | IClientAPI remote_client) |
112 | { | 113 | { |
113 | 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 | ||
116 | |||
114 | updatePacket.ParcelData.AABBMax = landData.AABBMax; | 117 | updatePacket.ParcelData.AABBMax = landData.AABBMax; |
115 | updatePacket.ParcelData.AABBMin = landData.AABBMin; | 118 | updatePacket.ParcelData.AABBMin = landData.AABBMin; |
116 | updatePacket.ParcelData.Area = landData.area; | 119 | updatePacket.ParcelData.Area = landData.area; |
@@ -334,7 +337,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
334 | 337 | ||
335 | if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) | 338 | if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both) |
336 | { | 339 | { |
337 | replyPacket = new ParcelAccessListReplyPacket(); | 340 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); |
338 | replyPacket.Data.AgentID = agentID; | 341 | replyPacket.Data.AgentID = agentID; |
339 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; | 342 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access; |
340 | replyPacket.Data.LocalID = landData.localID; | 343 | replyPacket.Data.LocalID = landData.localID; |
@@ -346,7 +349,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
346 | 349 | ||
347 | if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) | 350 | if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both) |
348 | { | 351 | { |
349 | replyPacket = new ParcelAccessListReplyPacket(); | 352 | replyPacket = (ParcelAccessListReplyPacket) PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); |
350 | replyPacket.Data.AgentID = agentID; | 353 | replyPacket.Data.AgentID = agentID; |
351 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; | 354 | replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban; |
352 | replyPacket.Data.LocalID = landData.localID; | 355 | replyPacket.Data.LocalID = landData.localID; |
@@ -657,7 +660,8 @@ namespace OpenSim.Region.Environment.LandManagement | |||
657 | 660 | ||
658 | bool firstCall = true; | 661 | bool firstCall = true; |
659 | int MAX_OBJECTS_PER_PACKET = 251; | 662 | int MAX_OBJECTS_PER_PACKET = 251; |
660 | 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 | ||
661 | ForceObjectSelectPacket.DataBlock[] data; | 665 | ForceObjectSelectPacket.DataBlock[] data; |
662 | while (resultLocalIDs.Count > 0) | 666 | while (resultLocalIDs.Count > 0) |
663 | { | 667 | { |
@@ -695,7 +699,9 @@ namespace OpenSim.Region.Environment.LandManagement | |||
695 | public void sendLandObjectOwners(IClientAPI remote_client) | 699 | public void sendLandObjectOwners(IClientAPI remote_client) |
696 | { | 700 | { |
697 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); | 701 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); |
698 | 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 | ||
704 | |||
699 | foreach (SceneObjectGroup obj in primsOverMe) | 705 | foreach (SceneObjectGroup obj in primsOverMe) |
700 | { | 706 | { |
701 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) | 707 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) |
@@ -725,7 +731,6 @@ namespace OpenSim.Region.Environment.LandManagement | |||
725 | 731 | ||
726 | num++; | 732 | num++; |
727 | } | 733 | } |
728 | |||
729 | pack.Data = dataBlock; | 734 | pack.Data = dataBlock; |
730 | } | 735 | } |
731 | remote_client.OutPacket(pack, ThrottleOutPacketType.Task); | 736 | remote_client.OutPacket(pack, ThrottleOutPacketType.Task); |
@@ -810,4 +815,4 @@ namespace OpenSim.Region.Environment.LandManagement | |||
810 | } | 815 | } |
811 | 816 | ||
812 | #endregion | 817 | #endregion |
813 | } \ No newline at end of file | 818 | } |
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; | |||
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
35 | using OpenSim.Region.Environment.Scenes; | 35 | using OpenSim.Region.Environment.Scenes; |
36 | using OpenSim.Region.Environment.Interfaces; | ||
36 | using OpenSim.Region.Physics.Manager; | 37 | using OpenSim.Region.Physics.Manager; |
37 | 38 | ||
38 | namespace OpenSim.Region.Environment.LandManagement | 39 | namespace OpenSim.Region.Environment.LandManagement |
@@ -493,7 +494,7 @@ namespace OpenSim.Region.Environment.LandManagement | |||
493 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | 494 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) |
494 | { | 495 | { |
495 | byteArrayCount = 0; | 496 | byteArrayCount = 0; |
496 | packet = new ParcelOverlayPacket(); | 497 | packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay); |
497 | packet.ParcelData.Data = byteArray; | 498 | packet.ParcelData.Data = byteArray; |
498 | packet.ParcelData.SequenceID = sequenceID; | 499 | packet.ParcelData.SequenceID = sequenceID; |
499 | remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task); | 500 | remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task); |
@@ -856,4 +857,4 @@ namespace OpenSim.Region.Environment.LandManagement | |||
856 | } | 857 | } |
857 | 858 | ||
858 | #endregion | 859 | #endregion |
859 | } \ No newline at end of file | 860 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 999b70f..647fbf4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -29,6 +29,8 @@ using System.Collections.Generic; | |||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using libsecondlife.Packets; | 30 | using libsecondlife.Packets; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Framework.UserManagement; | ||
33 | using OpenSim.Framework.Console; | ||
32 | 34 | ||
33 | namespace OpenSim.Region.Environment.Scenes | 35 | namespace OpenSim.Region.Environment.Scenes |
34 | { | 36 | { |
@@ -164,7 +166,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
164 | List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); | 166 | List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); |
165 | AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); | 167 | AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); |
166 | 168 | ||
167 | 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 | ||
171 | |||
168 | AvatarPickerReplyPacket.DataBlock[] searchData = | 172 | AvatarPickerReplyPacket.DataBlock[] searchData = |
169 | new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; | 173 | new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; |
170 | AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); | 174 | AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); |
@@ -192,4 +196,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
192 | client.SendAvatarPickerReply(replyPacket); | 196 | client.SendAvatarPickerReply(replyPacket); |
193 | } | 197 | } |
194 | } | 198 | } |
195 | } \ No newline at end of file | 199 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d8c5255..4657264 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -474,7 +474,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
474 | if (!avatar.IsChildAgent) | 474 | if (!avatar.IsChildAgent) |
475 | avatar.ControllingClient.Kick("The simulator is going down."); | 475 | avatar.ControllingClient.Kick("The simulator is going down."); |
476 | 476 | ||
477 | avatar.ControllingClient.OutPacket(new DisableSimulatorPacket(), | 477 | avatar.ControllingClient.OutPacket(PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator), |
478 | ThrottleOutPacketType.Task); | 478 | ThrottleOutPacketType.Task); |
479 | }); | 479 | }); |
480 | 480 | ||
@@ -1016,43 +1016,42 @@ namespace OpenSim.Region.Environment.Scenes | |||
1016 | // It's wrong many times though. | 1016 | // It's wrong many times though. |
1017 | 1017 | ||
1018 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); | 1018 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); |
1019 | |||
1020 | |||
1021 | |||
1019 | 1022 | ||
1020 | if (PermissionsMngr.CanRezObject(ownerID, pos)) | 1023 | if (PermissionsMngr.CanRezObject(ownerID, pos)) |
1021 | { | 1024 | { |
1022 | // rez ON the ground, not IN the ground | ||
1023 | pos.Z += 0.25F; | ||
1024 | |||
1025 | AddNewPrim(ownerID, pos, rot, shape); | ||
1026 | } | ||
1027 | } | ||
1028 | 1025 | ||
1029 | public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) | 1026 | // rez ON the ground, not IN the ground |
1030 | { | 1027 | pos.Z += 0.25F; |
1031 | SceneObjectGroup sceneOb = | 1028 | |
1032 | new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); | 1029 | |
1033 | 1030 | SceneObjectGroup sceneOb = | |
1034 | AddEntity(sceneOb); | 1031 | new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); |
1035 | SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); | 1032 | AddEntity(sceneOb); |
1036 | // if grass or tree, make phantom | 1033 | SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); |
1037 | //rootPart.ApplySanePermissions(); | 1034 | // if grass or tree, make phantom |
1038 | if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) | 1035 | //rootPart.ApplySanePermissions(); |
1039 | { | 1036 | if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) |
1040 | rootPart.AddFlag(LLObject.ObjectFlags.Phantom); | 1037 | { |
1041 | //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; | 1038 | rootPart.AddFlag(LLObject.ObjectFlags.Phantom); |
1042 | } | 1039 | //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; |
1043 | // if not phantom, add to physics | 1040 | } |
1044 | bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); | 1041 | // if not phantom, add to physics |
1045 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | 1042 | bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); |
1046 | { | 1043 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) |
1047 | rootPart.PhysActor = | 1044 | { |
1048 | PhysicsScene.AddPrimShape( | 1045 | rootPart.PhysActor = |
1049 | rootPart.Name, | 1046 | PhysicsScene.AddPrimShape( |
1050 | rootPart.Shape, | 1047 | rootPart.Name, |
1051 | new PhysicsVector(pos.X, pos.Y, pos.Z), | 1048 | rootPart.Shape, |
1052 | new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), | 1049 | new PhysicsVector(pos.X, pos.Y, pos.Z), |
1053 | new Quaternion(), UsePhysics); | 1050 | new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), |
1054 | // subscribe to physics events. | 1051 | new Quaternion(), UsePhysics); |
1055 | rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | 1052 | // subscribe to physics events. |
1053 | rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | ||
1054 | } | ||
1056 | } | 1055 | } |
1057 | } | 1056 | } |
1058 | 1057 | ||
@@ -1499,7 +1498,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1499 | m_innerScene.removeUserCount(true); | 1498 | m_innerScene.removeUserCount(true); |
1500 | } | 1499 | } |
1501 | // Tell a single agent to disconnect from the region. | 1500 | // Tell a single agent to disconnect from the region. |
1502 | DisableSimulatorPacket disable = new DisableSimulatorPacket(); | 1501 | libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator); |
1503 | presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); | 1502 | presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); |
1504 | } | 1503 | } |
1505 | } | 1504 | } |
@@ -2246,4 +2245,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
2246 | 2245 | ||
2247 | #endregion | 2246 | #endregion |
2248 | } | 2247 | } |
2249 | } \ No newline at end of file | 2248 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 5b74c9b..94b6797 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -74,13 +74,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
74 | { | 74 | { |
75 | get { return m_rootPart.RotationOffset; } | 75 | get { return m_rootPart.RotationOffset; } |
76 | } | 76 | } |
77 | |||
78 | public LLUUID GroupID | 77 | public LLUUID GroupID |
79 | { | 78 | { |
80 | get { return m_rootPart.GroupID; } | 79 | get { return m_rootPart.GroupID; } |
81 | set { m_rootPart.GroupID = value; } | 80 | set { m_rootPart.GroupID = value; } |
82 | } | 81 | } |
83 | |||
84 | /// <summary> | 82 | /// <summary> |
85 | /// | 83 | /// |
86 | /// </summary> | 84 | /// </summary> |
@@ -638,7 +636,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
638 | public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags) | 636 | public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags) |
639 | { | 637 | { |
640 | //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); | 638 | //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); |
641 | 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 | ||
641 | |||
642 | ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); | 642 | ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); |
643 | objPropDB.RequestFlags = RequestFlags; | 643 | objPropDB.RequestFlags = RequestFlags; |
644 | objPropDB.ObjectID = RootPart.UUID; | 644 | objPropDB.ObjectID = RootPart.UUID; |
@@ -1045,7 +1045,9 @@ 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 | ||
1050 | |||
1049 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | 1051 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; |
1050 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | 1052 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); |
1051 | proper.ObjectData[0].ItemID = LLUUID.Zero; | 1053 | proper.ObjectData[0].ItemID = LLUUID.Zero; |
@@ -1297,6 +1299,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1297 | m_rootPart.PhysActor.IsPhysical); | 1299 | m_rootPart.PhysActor.IsPhysical); |
1298 | bool UsePhysics = ((m_rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); | 1300 | bool UsePhysics = ((m_rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); |
1299 | m_rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | 1301 | m_rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); |
1302 | |||
1300 | } | 1303 | } |
1301 | } | 1304 | } |
1302 | 1305 | ||
@@ -1737,4 +1740,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
1737 | m_rootPart.ApplyPhysics(); | 1740 | m_rootPart.ApplyPhysics(); |
1738 | } | 1741 | } |
1739 | } | 1742 | } |
1740 | } \ No newline at end of file | 1743 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index b183c04..5033965 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | |||
@@ -83,7 +83,9 @@ 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 | ||
88 | |||
87 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; | 89 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; |
88 | statpack.Region = new SimStatsPacket.RegionBlock(); | 90 | statpack.Region = new SimStatsPacket.RegionBlock(); |
89 | statpack.Region.RegionX = ReportingRegion.RegionLocX; | 91 | statpack.Region.RegionX = ReportingRegion.RegionLocX; |
@@ -241,4 +243,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
241 | m_unAckedBytes += numBytes; | 243 | m_unAckedBytes += numBytes; |
242 | } | 244 | } |
243 | } | 245 | } |
244 | } \ No newline at end of file | 246 | } |