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/ClientStack/ClientView.cs | |
parent | * Moved PrimitiveBaseShape subclasses into factory methods - the subclassing ... (diff) | |
download | opensim-SC-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.zip opensim-SC-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.gz opensim-SC-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.bz2 opensim-SC-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/ClientStack/ClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 175 |
1 files changed, 97 insertions, 78 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]; |