aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-16 14:17:13 -0700
committerJohn Hurliman2009-10-16 14:17:13 -0700
commit1bd9202f2439ac73a70fa2a881f824797f61f589 (patch)
treeed09eb3671f5bbdec15baf4aaf9069f6ea203902 /OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim into priorit... (diff)
downloadopensim-SC_OLD-1bd9202f2439ac73a70fa2a881f824797f61f589.zip
opensim-SC_OLD-1bd9202f2439ac73a70fa2a881f824797f61f589.tar.gz
opensim-SC_OLD-1bd9202f2439ac73a70fa2a881f824797f61f589.tar.bz2
opensim-SC_OLD-1bd9202f2439ac73a70fa2a881f824797f61f589.tar.xz
* Simplified the prioritization packet creation code to reduce CPU usage and increase throughput. Apologies to Jim for hacking on your code while it's only halfway done, I'll take responsibility for the manual merge
* Changed LLUDP to use its own MTU value of 1400 instead of the 1200 value pulled from the currently shipped libomv
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs101
1 files changed, 17 insertions, 84 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 630b6e6..383eac0 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -347,10 +347,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
347 protected Dictionary<UUID,ulong> m_groupPowers = new Dictionary<UUID, ulong>(); 347 protected Dictionary<UUID,ulong> m_groupPowers = new Dictionary<UUID, ulong>();
348 protected int m_terrainCheckerCount; 348 protected int m_terrainCheckerCount;
349 349
350 // LL uses these limits, apparently. Compressed terse would be 23, but we don't have that yet 350 // These numbers are guesses at a decent tradeoff between responsiveness
351 protected int m_primTerseUpdatesPerPacket = 10; 351 // of the interest list and throughput. Lower is more responsive, higher
352 protected int m_primFullUpdatesPerPacket = 14; 352 // is better throughput
353 protected int m_avatarTerseUpdatesPerPacket = 5; 353 protected int m_primTerseUpdatesPerPacket = 25;
354 protected int m_primFullUpdatesPerPacket = 100;
355 protected int m_avatarTerseUpdatesPerPacket = 10;
354 /// <summary>Number of texture packets to put on the queue each time the 356 /// <summary>Number of texture packets to put on the queue each time the
355 /// OnQueueEmpty event is triggered for the texture category</summary> 357 /// OnQueueEmpty event is triggered for the texture category</summary>
356 protected int m_textureSendLimit = 20; 358 protected int m_textureSendLimit = 20;
@@ -3415,33 +3417,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3415 terse.RegionData.TimeDilation = 3417 terse.RegionData.TimeDilation =
3416 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3418 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3417 3419
3418 int max = m_avatarTerseUpdatesPerPacket; 3420 int count = Math.Min(m_avatarTerseUpdates.Count, m_avatarTerseUpdatesPerPacket);
3419 if (max > m_avatarTerseUpdates.Count)
3420 max = m_avatarTerseUpdates.Count;
3421
3422 int count = 0;
3423 int size = 0;
3424
3425 byte[] zerobuffer = new byte[1024];
3426 byte[] blockbuffer = new byte[1024];
3427
3428 Queue<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> updates = new Queue<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
3429
3430 for (count = 0 ; count < max ; count++)
3431 {
3432 int length = 0;
3433 m_avatarTerseUpdates.Peek().ToBytes(blockbuffer, ref length);
3434 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3435 if (size + length > Packet.MTU)
3436 break;
3437 size += length;
3438 updates.Enqueue(m_avatarTerseUpdates.Dequeue());
3439 }
3440 3421
3441 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[count]; 3422 terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[count];
3442 3423 for (int i = 0; i < count; i++)
3443 for (int i = 0 ; i < count ; i++) 3424 terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue();
3444 terse.ObjectData[i] = updates.Dequeue();
3445 3425
3446 terse.Header.Reliable = false; 3426 terse.Header.Reliable = false;
3447 terse.Header.Zerocoded = true; 3427 terse.Header.Zerocoded = true;
@@ -3656,34 +3636,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3656 outPacket.RegionData.TimeDilation = 3636 outPacket.RegionData.TimeDilation =
3657 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3637 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3658 3638
3659 int max = m_primFullUpdates.Count; 3639 int count = Math.Min(m_primFullUpdates.Count, m_primFullUpdatesPerPacket);
3660 if (max > m_primFullUpdatesPerPacket)
3661 max = m_primFullUpdatesPerPacket;
3662
3663 int count = 0;
3664 int size = 0;
3665 3640
3666 byte[] zerobuffer = new byte[1024]; 3641 outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count];
3667 byte[] blockbuffer = new byte[1024]; 3642 for (int i = 0; i < count; i++)
3668 3643 outPacket.ObjectData[i] = m_primFullUpdates.Dequeue();
3669 Queue<ObjectUpdatePacket.ObjectDataBlock> updates = new Queue<ObjectUpdatePacket.ObjectDataBlock>();
3670
3671 for (count = 0 ; count < max ; count++)
3672 {
3673 int length = 0;
3674 m_primFullUpdates.Peek().ToBytes(blockbuffer, ref length);
3675 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3676 if (size + length > Packet.MTU)
3677 break;
3678 size += length;
3679 updates.Enqueue(m_primFullUpdates.Dequeue());
3680 }
3681
3682 outPacket.ObjectData =
3683 new ObjectUpdatePacket.ObjectDataBlock[count];
3684
3685 for (int index = 0 ; index < count ; index++)
3686 outPacket.ObjectData[index] = updates.Dequeue();
3687 3644
3688 outPacket.Header.Zerocoded = true; 3645 outPacket.Header.Zerocoded = true;
3689 OutPacket(outPacket, ThrottleOutPacketType.State); 3646 OutPacket(outPacket, ThrottleOutPacketType.State);
@@ -3733,35 +3690,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3733 outPacket.RegionData.TimeDilation = 3690 outPacket.RegionData.TimeDilation =
3734 (ushort)(Scene.TimeDilation * ushort.MaxValue); 3691 (ushort)(Scene.TimeDilation * ushort.MaxValue);
3735 3692
3736 int max = m_primTerseUpdates.Count; 3693 int count = Math.Min(m_primTerseUpdates.Count, m_primTerseUpdatesPerPacket);
3737 if (max > m_primTerseUpdatesPerPacket)
3738 max = m_primTerseUpdatesPerPacket;
3739
3740 int count = 0;
3741 int size = 0;
3742
3743 byte[] zerobuffer = new byte[1024];
3744 byte[] blockbuffer = new byte[1024];
3745
3746 Queue<ImprovedTerseObjectUpdatePacket.ObjectDataBlock> updates = new Queue<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
3747
3748 for (count = 0 ; count < max ; count++)
3749 {
3750 int length = 0;
3751 m_primTerseUpdates.Peek().ToBytes(blockbuffer, ref length);
3752 length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
3753 if (size + length > Packet.MTU)
3754 break;
3755 size += length;
3756 updates.Enqueue(m_primTerseUpdates.Dequeue());
3757 }
3758
3759 outPacket.ObjectData =
3760 new ImprovedTerseObjectUpdatePacket.
3761 ObjectDataBlock[count];
3762 3694
3763 for (int index = 0 ; index < count ; index++) 3695 outPacket.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[count];
3764 outPacket.ObjectData[index] = updates.Dequeue(); 3696 for (int i = 0; i < count; i++)
3697 outPacket.ObjectData[i] = m_primTerseUpdates.Dequeue();
3765 3698
3766 outPacket.Header.Reliable = false; 3699 outPacket.Header.Reliable = false;
3767 outPacket.Header.Zerocoded = true; 3700 outPacket.Header.Zerocoded = true;