aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-12-05 23:25:30 +0000
committerMelanie2009-12-05 23:25:30 +0000
commit129de260329791529904c02c3515d40879d7d214 (patch)
tree88f3241b36303f9df21e6501df5ce93a3315cbe4
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-129de260329791529904c02c3515d40879d7d214.zip
opensim-SC-129de260329791529904c02c3515d40879d7d214.tar.gz
opensim-SC-129de260329791529904c02c3515d40879d7d214.tar.bz2
opensim-SC-129de260329791529904c02c3515d40879d7d214.tar.xz
Cause better packing of ObjectProperties
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs106
1 files changed, 79 insertions, 27 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index e812945..71f9b90 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -352,6 +352,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
352 private IHyperAssetService m_hyperAssets; 352 private IHyperAssetService m_hyperAssets;
353 private const bool m_checkPackets = true; 353 private const bool m_checkPackets = true;
354 354
355 private Timer m_propertiesPacketTimer;
356 private List<ObjectPropertiesPacket.ObjectDataBlock> m_propertiesBlocks = new List<ObjectPropertiesPacket.ObjectDataBlock>();
357
355 #endregion Class Members 358 #endregion Class Members
356 359
357 #region Properties 360 #region Properties
@@ -433,6 +436,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
433 m_udpClient.OnQueueEmpty += HandleQueueEmpty; 436 m_udpClient.OnQueueEmpty += HandleQueueEmpty;
434 m_udpClient.OnPacketStats += PopulateStats; 437 m_udpClient.OnPacketStats += PopulateStats;
435 438
439 m_propertiesPacketTimer = new Timer(100);
440 m_propertiesPacketTimer.Elapsed += ProcessObjectPropertiesPacket;
441
436 RegisterLocalPacketHandlers(); 442 RegisterLocalPacketHandlers();
437 } 443 }
438 444
@@ -3562,42 +3568,88 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3562 string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, 3568 string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask,
3563 uint BaseMask, byte saleType, int salePrice) 3569 uint BaseMask, byte saleType, int salePrice)
3564 { 3570 {
3565 ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 3571 //ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
3566 // TODO: don't create new blocks if recycling an old packet 3572 // TODO: don't create new blocks if recycling an old packet
3567 3573
3568 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 3574 ObjectPropertiesPacket.ObjectDataBlock block =
3569 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 3575 new ObjectPropertiesPacket.ObjectDataBlock();
3570 proper.ObjectData[0].ItemID = ItemID; 3576
3571 proper.ObjectData[0].CreationDate = CreationDate; 3577 block.ItemID = ItemID;
3572 proper.ObjectData[0].CreatorID = CreatorUUID; 3578 block.CreationDate = CreationDate;
3573 proper.ObjectData[0].FolderID = FolderUUID; 3579 block.CreatorID = CreatorUUID;
3574 proper.ObjectData[0].FromTaskID = FromTaskUUID; 3580 block.FolderID = FolderUUID;
3575 proper.ObjectData[0].GroupID = GroupUUID; 3581 block.FromTaskID = FromTaskUUID;
3576 proper.ObjectData[0].InventorySerial = InventorySerial; 3582 block.GroupID = GroupUUID;
3577 3583 block.InventorySerial = InventorySerial;
3578 proper.ObjectData[0].LastOwnerID = LastOwnerUUID; 3584
3585 block.LastOwnerID = LastOwnerUUID;
3579 // proper.ObjectData[0].LastOwnerID = UUID.Zero; 3586 // proper.ObjectData[0].LastOwnerID = UUID.Zero;
3580 3587
3581 proper.ObjectData[0].ObjectID = ObjectUUID; 3588 block.ObjectID = ObjectUUID;
3582 if (OwnerUUID == GroupUUID) 3589 if (OwnerUUID == GroupUUID)
3583 proper.ObjectData[0].OwnerID = UUID.Zero; 3590 block.OwnerID = UUID.Zero;
3584 else 3591 else
3585 proper.ObjectData[0].OwnerID = OwnerUUID; 3592 block.OwnerID = OwnerUUID;
3586 proper.ObjectData[0].TouchName = Util.StringToBytes256(TouchTitle); 3593 block.TouchName = Util.StringToBytes256(TouchTitle);
3587 proper.ObjectData[0].TextureID = TextureID; 3594 block.TextureID = TextureID;
3588 proper.ObjectData[0].SitName = Util.StringToBytes256(SitTitle); 3595 block.SitName = Util.StringToBytes256(SitTitle);
3589 proper.ObjectData[0].Name = Util.StringToBytes256(ItemName); 3596 block.Name = Util.StringToBytes256(ItemName);
3590 proper.ObjectData[0].Description = Util.StringToBytes256(ItemDescription); 3597 block.Description = Util.StringToBytes256(ItemDescription);
3591 proper.ObjectData[0].OwnerMask = OwnerMask; 3598 block.OwnerMask = OwnerMask;
3592 proper.ObjectData[0].NextOwnerMask = NextOwnerMask; 3599 block.NextOwnerMask = NextOwnerMask;
3593 proper.ObjectData[0].GroupMask = GroupMask; 3600 block.GroupMask = GroupMask;
3594 proper.ObjectData[0].EveryoneMask = EveryoneMask; 3601 block.EveryoneMask = EveryoneMask;
3595 proper.ObjectData[0].BaseMask = BaseMask; 3602 block.BaseMask = BaseMask;
3596 // proper.ObjectData[0].AggregatePerms = 53; 3603 // proper.ObjectData[0].AggregatePerms = 53;
3597 // proper.ObjectData[0].AggregatePermTextures = 0; 3604 // proper.ObjectData[0].AggregatePermTextures = 0;
3598 // proper.ObjectData[0].AggregatePermTexturesOwner = 0; 3605 // proper.ObjectData[0].AggregatePermTexturesOwner = 0;
3599 proper.ObjectData[0].SaleType = saleType; 3606 block.SaleType = saleType;
3600 proper.ObjectData[0].SalePrice = salePrice; 3607 block.SalePrice = salePrice;
3608
3609 lock (m_propertiesPacketTimer)
3610 {
3611 m_propertiesBlocks.Add(block);
3612
3613 int length = 0;
3614 foreach (ObjectPropertiesPacket.ObjectDataBlock b in m_propertiesBlocks)
3615 {
3616 length += b.Length;
3617 }
3618 if (length > 1100) // FIXME: use real MTU
3619 {
3620 ProcessObjectPropertiesPacket(null, null);
3621 m_propertiesPacketTimer.Stop();
3622 return;
3623 }
3624
3625 m_propertiesPacketTimer.Stop();
3626 m_propertiesPacketTimer.Start();
3627 }
3628
3629 //proper.Header.Zerocoded = true;
3630 //OutPacket(proper, ThrottleOutPacketType.Task);
3631 }
3632
3633 private void ProcessObjectPropertiesPacket(Object sender, ElapsedEventArgs e)
3634 {
3635 ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
3636
3637 lock (m_propertiesPacketTimer)
3638 {
3639 m_propertiesPacketTimer.Stop();
3640
3641 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count];
3642
3643 int index = 0;
3644
3645 foreach (ObjectPropertiesPacket.ObjectDataBlock b in m_propertiesBlocks)
3646 {
3647 proper.ObjectData[index++] = b;
3648 }
3649
3650 m_propertiesBlocks.Clear();
3651 }
3652
3601 proper.Header.Zerocoded = true; 3653 proper.Header.Zerocoded = true;
3602 OutPacket(proper, ThrottleOutPacketType.Task); 3654 OutPacket(proper, ThrottleOutPacketType.Task);
3603 } 3655 }