diff options
author | Melanie | 2009-12-05 23:25:30 +0000 |
---|---|---|
committer | Melanie | 2009-12-06 02:53:24 +0000 |
commit | f8cc409034528f645628bd022aba9657545637f8 (patch) | |
tree | 508f1138aaa33b6771cb216cbff1f9c83fbe81ea /OpenSim/Region | |
parent | * Fix line endings in BaseHttpServer.cs (diff) | |
download | opensim-SC-f8cc409034528f645628bd022aba9657545637f8.zip opensim-SC-f8cc409034528f645628bd022aba9657545637f8.tar.gz opensim-SC-f8cc409034528f645628bd022aba9657545637f8.tar.bz2 opensim-SC-f8cc409034528f645628bd022aba9657545637f8.tar.xz |
Cause better packing of ObjectProperties
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 106 |
1 files changed, 79 insertions, 27 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index ffe6fe9..fba5090 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 | ||
@@ -3579,42 +3585,88 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3579 | string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, | 3585 | string ItemDescription, uint OwnerMask, uint NextOwnerMask, uint GroupMask, uint EveryoneMask, |
3580 | uint BaseMask, byte saleType, int salePrice) | 3586 | uint BaseMask, byte saleType, int salePrice) |
3581 | { | 3587 | { |
3582 | ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); | 3588 | //ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); |
3583 | // TODO: don't create new blocks if recycling an old packet | 3589 | // TODO: don't create new blocks if recycling an old packet |
3584 | 3590 | ||
3585 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | 3591 | ObjectPropertiesPacket.ObjectDataBlock block = |
3586 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | 3592 | new ObjectPropertiesPacket.ObjectDataBlock(); |
3587 | proper.ObjectData[0].ItemID = ItemID; | 3593 | |
3588 | proper.ObjectData[0].CreationDate = CreationDate; | 3594 | block.ItemID = ItemID; |
3589 | proper.ObjectData[0].CreatorID = CreatorUUID; | 3595 | block.CreationDate = CreationDate; |
3590 | proper.ObjectData[0].FolderID = FolderUUID; | 3596 | block.CreatorID = CreatorUUID; |
3591 | proper.ObjectData[0].FromTaskID = FromTaskUUID; | 3597 | block.FolderID = FolderUUID; |
3592 | proper.ObjectData[0].GroupID = GroupUUID; | 3598 | block.FromTaskID = FromTaskUUID; |
3593 | proper.ObjectData[0].InventorySerial = InventorySerial; | 3599 | block.GroupID = GroupUUID; |
3594 | 3600 | block.InventorySerial = InventorySerial; | |
3595 | proper.ObjectData[0].LastOwnerID = LastOwnerUUID; | 3601 | |
3602 | block.LastOwnerID = LastOwnerUUID; | ||
3596 | // proper.ObjectData[0].LastOwnerID = UUID.Zero; | 3603 | // proper.ObjectData[0].LastOwnerID = UUID.Zero; |
3597 | 3604 | ||
3598 | proper.ObjectData[0].ObjectID = ObjectUUID; | 3605 | block.ObjectID = ObjectUUID; |
3599 | if (OwnerUUID == GroupUUID) | 3606 | if (OwnerUUID == GroupUUID) |
3600 | proper.ObjectData[0].OwnerID = UUID.Zero; | 3607 | block.OwnerID = UUID.Zero; |
3601 | else | 3608 | else |
3602 | proper.ObjectData[0].OwnerID = OwnerUUID; | 3609 | block.OwnerID = OwnerUUID; |
3603 | proper.ObjectData[0].TouchName = Util.StringToBytes256(TouchTitle); | 3610 | block.TouchName = Util.StringToBytes256(TouchTitle); |
3604 | proper.ObjectData[0].TextureID = TextureID; | 3611 | block.TextureID = TextureID; |
3605 | proper.ObjectData[0].SitName = Util.StringToBytes256(SitTitle); | 3612 | block.SitName = Util.StringToBytes256(SitTitle); |
3606 | proper.ObjectData[0].Name = Util.StringToBytes256(ItemName); | 3613 | block.Name = Util.StringToBytes256(ItemName); |
3607 | proper.ObjectData[0].Description = Util.StringToBytes256(ItemDescription); | 3614 | block.Description = Util.StringToBytes256(ItemDescription); |
3608 | proper.ObjectData[0].OwnerMask = OwnerMask; | 3615 | block.OwnerMask = OwnerMask; |
3609 | proper.ObjectData[0].NextOwnerMask = NextOwnerMask; | 3616 | block.NextOwnerMask = NextOwnerMask; |
3610 | proper.ObjectData[0].GroupMask = GroupMask; | 3617 | block.GroupMask = GroupMask; |
3611 | proper.ObjectData[0].EveryoneMask = EveryoneMask; | 3618 | block.EveryoneMask = EveryoneMask; |
3612 | proper.ObjectData[0].BaseMask = BaseMask; | 3619 | block.BaseMask = BaseMask; |
3613 | // proper.ObjectData[0].AggregatePerms = 53; | 3620 | // proper.ObjectData[0].AggregatePerms = 53; |
3614 | // proper.ObjectData[0].AggregatePermTextures = 0; | 3621 | // proper.ObjectData[0].AggregatePermTextures = 0; |
3615 | // proper.ObjectData[0].AggregatePermTexturesOwner = 0; | 3622 | // proper.ObjectData[0].AggregatePermTexturesOwner = 0; |
3616 | proper.ObjectData[0].SaleType = saleType; | 3623 | block.SaleType = saleType; |
3617 | proper.ObjectData[0].SalePrice = salePrice; | 3624 | block.SalePrice = salePrice; |
3625 | |||
3626 | lock (m_propertiesPacketTimer) | ||
3627 | { | ||
3628 | m_propertiesBlocks.Add(block); | ||
3629 | |||
3630 | int length = 0; | ||
3631 | foreach (ObjectPropertiesPacket.ObjectDataBlock b in m_propertiesBlocks) | ||
3632 | { | ||
3633 | length += b.Length; | ||
3634 | } | ||
3635 | if (length > 1100) // FIXME: use real MTU | ||
3636 | { | ||
3637 | ProcessObjectPropertiesPacket(null, null); | ||
3638 | m_propertiesPacketTimer.Stop(); | ||
3639 | return; | ||
3640 | } | ||
3641 | |||
3642 | m_propertiesPacketTimer.Stop(); | ||
3643 | m_propertiesPacketTimer.Start(); | ||
3644 | } | ||
3645 | |||
3646 | //proper.Header.Zerocoded = true; | ||
3647 | //OutPacket(proper, ThrottleOutPacketType.Task); | ||
3648 | } | ||
3649 | |||
3650 | private void ProcessObjectPropertiesPacket(Object sender, ElapsedEventArgs e) | ||
3651 | { | ||
3652 | ObjectPropertiesPacket proper = (ObjectPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ObjectProperties); | ||
3653 | |||
3654 | lock (m_propertiesPacketTimer) | ||
3655 | { | ||
3656 | m_propertiesPacketTimer.Stop(); | ||
3657 | |||
3658 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count]; | ||
3659 | |||
3660 | int index = 0; | ||
3661 | |||
3662 | foreach (ObjectPropertiesPacket.ObjectDataBlock b in m_propertiesBlocks) | ||
3663 | { | ||
3664 | proper.ObjectData[index++] = b; | ||
3665 | } | ||
3666 | |||
3667 | m_propertiesBlocks.Clear(); | ||
3668 | } | ||
3669 | |||
3618 | proper.Header.Zerocoded = true; | 3670 | proper.Header.Zerocoded = true; |
3619 | OutPacket(proper, ThrottleOutPacketType.Task); | 3671 | OutPacket(proper, ThrottleOutPacketType.Task); |
3620 | } | 3672 | } |