diff options
author | UbitUmarov | 2019-01-29 21:11:21 +0000 |
---|---|---|
committer | UbitUmarov | 2019-01-29 21:11:21 +0000 |
commit | 6479eb9022b25c49eb1fe8e2f3b7f986f88f72bb (patch) | |
tree | 4481ceec3fab7b43fc9061a1d12c78960fddaa32 /OpenSim | |
parent | ubode replace a locklessqueue by .net concurrentqueue (diff) | |
download | opensim-SC-6479eb9022b25c49eb1fe8e2f3b7f986f88f72bb.zip opensim-SC-6479eb9022b25c49eb1fe8e2f3b7f986f88f72bb.tar.gz opensim-SC-6479eb9022b25c49eb1fe8e2f3b7f986f88f72bb.tar.bz2 opensim-SC-6479eb9022b25c49eb1fe8e2f3b7f986f88f72bb.tar.xz |
change encoding few event cap messages
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 213 |
1 files changed, 89 insertions, 124 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0d55575..357d16a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -13074,15 +13074,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
13074 | } | 13074 | } |
13075 | } | 13075 | } |
13076 | 13076 | ||
13077 | public static OSD BuildEvent(string eventName, OSD eventBody) | ||
13078 | { | ||
13079 | OSDMap osdEvent = new OSDMap(2); | ||
13080 | osdEvent.Add("message", new OSDString(eventName)); | ||
13081 | osdEvent.Add("body", eventBody); | ||
13082 | |||
13083 | return osdEvent; | ||
13084 | } | ||
13085 | |||
13086 | public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) | 13077 | public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) |
13087 | { | 13078 | { |
13088 | AvatarInterestsReplyPacket packet = (AvatarInterestsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarInterestsReply); | 13079 | AvatarInterestsReplyPacket packet = (AvatarInterestsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarInterestsReply); |
@@ -13235,39 +13226,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
13235 | public void SendRemoveInventoryItems(UUID[] items) | 13226 | public void SendRemoveInventoryItems(UUID[] items) |
13236 | { | 13227 | { |
13237 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); | 13228 | IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); |
13238 | |||
13239 | if (eq == null) | 13229 | if (eq == null) |
13240 | { | 13230 | { |
13241 | m_log.DebugFormat("[LLCLIENT]: Null event queue"); | 13231 | m_log.DebugFormat("[LLCLIENT]: Null event queue"); |
13242 | return; | 13232 | return; |
13243 | } | 13233 | } |
13244 | 13234 | ||
13245 | OSDMap llsd = new OSDMap(3); | 13235 | StringBuilder sb = eq.StartEvent("RemoveInventoryItem"); |
13246 | |||
13247 | OSDMap AgentDataMap = new OSDMap(1); | ||
13248 | AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | ||
13249 | AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); | ||
13250 | |||
13251 | OSDArray AgentData = new OSDArray(1); | ||
13252 | AgentData.Add(AgentDataMap); | ||
13253 | |||
13254 | llsd.Add("AgentData", AgentData); | ||
13255 | 13236 | ||
13256 | OSDArray ItemData = new OSDArray(); | 13237 | LLSDxmlEncode.AddArrayAndMap("AgentData", sb); |
13238 | LLSDxmlEncode.AddElem("AgentID", AgentId, sb); | ||
13239 | LLSDxmlEncode.AddElem("SessionID", SessionId, sb); | ||
13240 | LLSDxmlEncode.AddEndMapAndArray(sb); | ||
13257 | 13241 | ||
13242 | LLSDxmlEncode.AddArray("InventoryData", sb); | ||
13258 | foreach (UUID item in items) | 13243 | foreach (UUID item in items) |
13259 | { | 13244 | { |
13260 | OSDMap ItemDataMap = new OSDMap(2); | 13245 | LLSDxmlEncode.AddMap(sb); |
13261 | ItemDataMap.Add("ItemID", OSD.FromUUID(item)); | 13246 | LLSDxmlEncode.AddElem("ItemID",item, sb); |
13262 | ItemDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | 13247 | LLSDxmlEncode.AddEndMap(sb); |
13263 | |||
13264 | ItemData.Add(ItemDataMap); | ||
13265 | } | 13248 | } |
13249 | LLSDxmlEncode.AddEndArray(sb); | ||
13266 | 13250 | ||
13267 | llsd.Add("InventoryData", ItemData); | 13251 | OSD ev = new OSDllsdxml(eq.EndEvent(sb)); |
13268 | 13252 | eq.Enqueue(ev, AgentId); | |
13269 | eq.Enqueue(BuildEvent("RemoveInventoryItem", | ||
13270 | llsd), AgentId); | ||
13271 | } | 13253 | } |
13272 | 13254 | ||
13273 | public void SendRemoveInventoryFolders(UUID[] folders) | 13255 | public void SendRemoveInventoryFolders(UUID[] folders) |
@@ -13280,40 +13262,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
13280 | return; | 13262 | return; |
13281 | } | 13263 | } |
13282 | 13264 | ||
13283 | OSDMap llsd = new OSDMap(3); | 13265 | StringBuilder sb = eq.StartEvent("RemoveInventoryFolder"); |
13284 | 13266 | ||
13285 | OSDMap AgentDataMap = new OSDMap(1); | 13267 | LLSDxmlEncode.AddArrayAndMap("AgentData", sb); |
13286 | AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | 13268 | LLSDxmlEncode.AddElem("AgentID", AgentId, sb); |
13287 | AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); | 13269 | LLSDxmlEncode.AddElem("SessionID", SessionId, sb); |
13288 | 13270 | LLSDxmlEncode.AddEndMapAndArray(sb); | |
13289 | OSDArray AgentData = new OSDArray(1); | ||
13290 | AgentData.Add(AgentDataMap); | ||
13291 | |||
13292 | llsd.Add("AgentData", AgentData); | ||
13293 | |||
13294 | OSDArray FolderData = new OSDArray(); | ||
13295 | 13271 | ||
13272 | LLSDxmlEncode.AddArray("FolderData", sb); | ||
13296 | foreach (UUID folder in folders) | 13273 | foreach (UUID folder in folders) |
13297 | { | 13274 | { |
13298 | OSDMap FolderDataMap = new OSDMap(2); | 13275 | LLSDxmlEncode.AddMap(sb); |
13299 | FolderDataMap.Add("FolderID", OSD.FromUUID(folder)); | 13276 | LLSDxmlEncode.AddElem("FolderID", folder, sb); |
13300 | FolderDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | 13277 | LLSDxmlEncode.AddEndMap(sb); |
13301 | |||
13302 | FolderData.Add(FolderDataMap); | ||
13303 | } | 13278 | } |
13279 | LLSDxmlEncode.AddEndArray(sb); | ||
13304 | 13280 | ||
13305 | llsd.Add("FolderData", FolderData); | 13281 | OSD ev = new OSDllsdxml(eq.EndEvent(sb)); |
13306 | 13282 | eq.Enqueue(ev, AgentId); | |
13307 | eq.Enqueue(BuildEvent("RemoveInventoryFolder", | ||
13308 | llsd), AgentId); | ||
13309 | } | ||
13310 | |||
13311 | private byte[] EncodeU32(uint val) | ||
13312 | { | ||
13313 | byte[] ret = BitConverter.GetBytes(val); | ||
13314 | if (BitConverter.IsLittleEndian) | ||
13315 | Array.Reverse(ret); | ||
13316 | return ret; | ||
13317 | } | 13283 | } |
13318 | 13284 | ||
13319 | public void SendBulkUpdateInventory(InventoryFolderBase[] folders, InventoryItemBase[] items) | 13285 | public void SendBulkUpdateInventory(InventoryFolderBase[] folders, InventoryItemBase[] items) |
@@ -13326,80 +13292,79 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
13326 | return; | 13292 | return; |
13327 | } | 13293 | } |
13328 | 13294 | ||
13329 | OSDMap llsd = new OSDMap(3); | 13295 | StringBuilder sb = eq.StartEvent("BulkUpdateInventory"); |
13330 | |||
13331 | OSDMap AgentDataMap = new OSDMap(1); | ||
13332 | AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | ||
13333 | AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); | ||
13334 | AgentDataMap.Add("TransactionID", OSD.FromUUID(UUID.Random())); | ||
13335 | 13296 | ||
13336 | OSDArray AgentData = new OSDArray(1); | 13297 | LLSDxmlEncode.AddArrayAndMap("AgentData", sb); |
13337 | AgentData.Add(AgentDataMap); | 13298 | LLSDxmlEncode.AddElem("AgentID", AgentId, sb); |
13338 | 13299 | LLSDxmlEncode.AddElem("TransactionID", UUID.Random(), sb); | |
13339 | llsd.Add("AgentData", AgentData); | 13300 | LLSDxmlEncode.AddEndMapAndArray(sb); |
13340 | |||
13341 | OSDArray FolderData = new OSDArray(); | ||
13342 | 13301 | ||
13343 | foreach (InventoryFolderBase folder in folders) | 13302 | if(folders.Length == 0) |
13344 | { | 13303 | { |
13345 | OSDMap FolderDataMap = new OSDMap(5); | 13304 | LLSDxmlEncode.AddEmptyArray("FolderData", sb); |
13346 | FolderDataMap.Add("FolderID", OSD.FromUUID(folder.ID)); | 13305 | } |
13347 | FolderDataMap.Add("AgentID", OSD.FromUUID(AgentId)); | 13306 | else |
13348 | FolderDataMap.Add("ParentID", OSD.FromUUID(folder.ParentID)); | 13307 | { |
13349 | FolderDataMap.Add("Type", OSD.FromInteger(folder.Type)); | 13308 | LLSDxmlEncode.AddArray("FolderData", sb); |
13350 | FolderDataMap.Add("Name", OSD.FromString(folder.Name)); | 13309 | foreach (InventoryFolderBase folder in folders) |
13351 | 13310 | { | |
13352 | FolderData.Add(FolderDataMap); | 13311 | LLSDxmlEncode.AddMap(sb); |
13312 | LLSDxmlEncode.AddElem("FolderID", folder.ID, sb); | ||
13313 | LLSDxmlEncode.AddElem("ParentID", folder.ParentID, sb); | ||
13314 | LLSDxmlEncode.AddElem("Type", (int)folder.Type, sb); | ||
13315 | LLSDxmlEncode.AddElem("Name", folder.Name, sb); | ||
13316 | LLSDxmlEncode.AddEndMap(sb); | ||
13317 | } | ||
13318 | LLSDxmlEncode.AddEndArray(sb); | ||
13353 | } | 13319 | } |
13354 | 13320 | ||
13355 | llsd.Add("FolderData", FolderData); | 13321 | if(items.Length == 0) |
13356 | |||
13357 | OSDArray ItemData = new OSDArray(); | ||
13358 | |||
13359 | foreach (InventoryItemBase item in items) | ||
13360 | { | 13322 | { |
13361 | OSDMap ItemDataMap = new OSDMap(); | 13323 | LLSDxmlEncode.AddEmptyArray("ItemData", sb); |
13362 | 13324 | } | |
13363 | ItemDataMap.Add("ItemID", OSD.FromUUID(item.ID)); | 13325 | else |
13364 | ItemDataMap.Add("FolderID", OSD.FromUUID(item.Folder)); | 13326 | { |
13365 | 13327 | LLSDxmlEncode.AddArray("ItemData", sb); | |
13366 | ItemDataMap.Add("CreatorID", OSD.FromUUID(item.CreatorIdAsUuid)); | 13328 | foreach (InventoryItemBase item in items) |
13367 | ItemDataMap.Add("OwnerID", OSD.FromUUID(item.Owner)); | 13329 | { |
13368 | ItemDataMap.Add("GroupID", OSD.FromUUID(item.GroupID)); | 13330 | LLSDxmlEncode.AddMap(sb); |
13369 | ItemDataMap.Add("BaseMask", OSD.FromBinary(EncodeU32((uint)item.BasePermissions))); | 13331 | LLSDxmlEncode.AddElem("ItemID", item.ID, sb); |
13370 | ItemDataMap.Add("OwnerMask", OSD.FromBinary(EncodeU32((uint)item.CurrentPermissions))); | 13332 | LLSDxmlEncode.AddElem("CallbackID", (uint)0, sb); |
13371 | ItemDataMap.Add("GroupMask", OSD.FromBinary(EncodeU32((uint)item.GroupPermissions))); | 13333 | LLSDxmlEncode.AddElem("FolderID", item.Folder, sb); |
13372 | ItemDataMap.Add("EveryoneMask", OSD.FromBinary(EncodeU32((uint)item.EveryOnePermissions))); | 13334 | LLSDxmlEncode.AddElem("CreatorID", item.CreatorIdAsUuid, sb); |
13373 | ItemDataMap.Add("NextOwnerMask", OSD.FromBinary(EncodeU32((uint)item.NextPermissions))); | 13335 | LLSDxmlEncode.AddElem("OwnerID", item.Owner, sb); |
13374 | ItemDataMap.Add("GroupOwned", OSD.FromBoolean(item.GroupOwned)); | 13336 | LLSDxmlEncode.AddElem("GroupID", item.GroupID, sb); |
13375 | ItemDataMap.Add("AssetID", OSD.FromUUID(item.AssetID)); | 13337 | LLSDxmlEncode.AddElem("BaseMask", item.BasePermissions, sb); |
13376 | ItemDataMap.Add("Type", OSD.FromInteger(item.AssetType)); | 13338 | LLSDxmlEncode.AddElem("OwnerMask", item.CurrentPermissions, sb); |
13377 | ItemDataMap.Add("InvType", OSD.FromInteger(item.InvType)); | 13339 | LLSDxmlEncode.AddElem("GroupMask", item.GroupPermissions, sb); |
13378 | ItemDataMap.Add("Flags", OSD.FromBinary(EncodeU32((uint)item.Flags))); | 13340 | LLSDxmlEncode.AddElem("EveryoneMask", item.EveryOnePermissions, sb); |
13379 | ItemDataMap.Add("SaleType", OSD.FromInteger((byte)item.SaleType)); | 13341 | LLSDxmlEncode.AddElem("NextOwnerMask", item.NextPermissions, sb); |
13380 | ItemDataMap.Add("SalePrice", OSD.FromInteger(item.SalePrice)); | 13342 | LLSDxmlEncode.AddElem("GroupOwned", item.GroupOwned, sb); |
13381 | ItemDataMap.Add("Name", OSD.FromString(item.Name)); | 13343 | LLSDxmlEncode.AddElem("AssetID", item.AssetID, sb); |
13382 | ItemDataMap.Add("Description", OSD.FromString(item.Description)); | 13344 | LLSDxmlEncode.AddElem("Type", item.AssetType, sb); |
13383 | ItemDataMap.Add("CreationDate", OSD.FromInteger(item.CreationDate)); | 13345 | LLSDxmlEncode.AddElem("InvType", item.InvType, sb); |
13384 | 13346 | LLSDxmlEncode.AddElem("Flags", item.Flags, sb); | |
13385 | ItemDataMap.Add("CRC", OSD.FromBinary(EncodeU32( | 13347 | LLSDxmlEncode.AddElem("SaleType", item.SaleType, sb); |
13386 | Helpers.InventoryCRC(1000, 0, (sbyte)item.InvType, | 13348 | LLSDxmlEncode.AddElem("SalePrice", item.SalePrice, sb); |
13387 | (sbyte)item.AssetType, item.AssetID, | 13349 | LLSDxmlEncode.AddElem("Name", item.Name, sb); |
13388 | item.GroupID, 100, | 13350 | LLSDxmlEncode.AddElem("Description", item.Description, sb); |
13389 | item.Owner, item.CreatorIdAsUuid, | 13351 | LLSDxmlEncode.AddElem("CreationDate", item.CreationDate, sb); |
13390 | item.ID, item.Folder, | 13352 | LLSDxmlEncode.AddElem("CRC", |
13391 | (uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All, | 13353 | Helpers.InventoryCRC(1000, 0, (sbyte)item.InvType, |
13392 | (uint)PermissionMask.All) | 13354 | (sbyte)item.AssetType, item.AssetID, |
13393 | ))); | 13355 | item.GroupID, 100, |
13394 | ItemDataMap.Add("CallbackID", 0); | 13356 | item.Owner, item.CreatorIdAsUuid, |
13395 | 13357 | item.ID, item.Folder, | |
13396 | ItemData.Add(ItemDataMap); | 13358 | (uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All, |
13359 | (uint)PermissionMask.All), | ||
13360 | sb); | ||
13361 | LLSDxmlEncode.AddEndMap(sb); | ||
13362 | } | ||
13363 | LLSDxmlEncode.AddEndArray(sb); | ||
13397 | } | 13364 | } |
13398 | 13365 | ||
13399 | llsd.Add("ItemData", ItemData); | 13366 | OSD ev = new OSDllsdxml(eq.EndEvent(sb)); |
13400 | 13367 | eq.Enqueue(ev, AgentId); | |
13401 | eq.Enqueue(BuildEvent("BulkUpdateInventory", | ||
13402 | llsd), AgentId); | ||
13403 | } | 13368 | } |
13404 | 13369 | ||
13405 | private HashSet<string> m_outPacketsToDrop; | 13370 | private HashSet<string> m_outPacketsToDrop; |