aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
diff options
context:
space:
mode:
authorJohn Hurliman2010-05-20 23:53:27 -0700
committerJohn Hurliman2010-05-20 23:53:27 -0700
commit9f2d1e9294f7f183e52d0cc5d98c8231e0e55fca (patch)
treec77b69464700d73fe9e80c0a24d0dabce265fdb1 /OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
parentEnsure that the first update sent out for any given prim is a full update (diff)
downloadopensim-SC_OLD-9f2d1e9294f7f183e52d0cc5d98c8231e0e55fca.zip
opensim-SC_OLD-9f2d1e9294f7f183e52d0cc5d98c8231e0e55fca.tar.gz
opensim-SC_OLD-9f2d1e9294f7f183e52d0cc5d98c8231e0e55fca.tar.bz2
opensim-SC_OLD-9f2d1e9294f7f183e52d0cc5d98c8231e0e55fca.tar.xz
* Made PriorityQueue non-generic so it natively understands EntityUpdate structs
* Replaced the per-avatar seen update tracking with update flag combining, to avoid overwriting full updates with terse updates
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs70
1 files changed, 32 insertions, 38 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index cf78266..c8a542b 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -324,8 +324,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
324 private readonly IGroupsModule m_GroupsModule; 324 private readonly IGroupsModule m_GroupsModule;
325 325
326 private int m_cachedTextureSerial; 326 private int m_cachedTextureSerial;
327 private PriorityQueue<double, EntityUpdate> m_entityUpdates; 327 private PriorityQueue m_entityUpdates;
328 private Dictionary<uint, bool> m_seenPrims = new Dictionary<uint, bool>();
329 328
330 /// <value> 329 /// <value>
331 /// List used in construction of data blocks for an object update packet. This is to stop us having to 330 /// List used in construction of data blocks for an object update packet. This is to stop us having to
@@ -436,7 +435,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
436 435
437 m_scene = scene; 436 m_scene = scene;
438 437
439 m_entityUpdates = new PriorityQueue<double, EntityUpdate>(m_scene.Entities.Count); 438 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
440 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); 439 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
441 m_killRecord = new HashSet<uint>(); 440 m_killRecord = new HashSet<uint>();
442 441
@@ -3499,14 +3498,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3499 { 3498 {
3500 canUseCompressed = false; 3499 canUseCompressed = false;
3501 } 3500 }
3502 else
3503 {
3504 if (!m_seenPrims.ContainsKey(((SceneObjectPart)update.Entity).LocalId))
3505 {
3506 updateFlags = PrimUpdateFlags.FullUpdate;
3507 m_seenPrims[((SceneObjectPart)update.Entity).LocalId] = true;
3508 }
3509 }
3510 3501
3511 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate)) 3502 if (updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
3512 { 3503 {
@@ -3626,7 +3617,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3626 { 3617 {
3627 //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName); 3618 //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName);
3628 3619
3629 PriorityQueue<double, EntityUpdate>.UpdatePriorityHandler update_priority_handler = 3620 PriorityQueue.UpdatePriorityHandler update_priority_handler =
3630 delegate(ref double priority, uint local_id) 3621 delegate(ref double priority, uint local_id)
3631 { 3622 {
3632 priority = handler(new UpdatePriorityData(priority, local_id)); 3623 priority = handler(new UpdatePriorityData(priority, local_id));
@@ -11562,26 +11553,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11562 } 11553 }
11563 11554
11564 #region PriorityQueue 11555 #region PriorityQueue
11565 public class PriorityQueue<TPriority, TValue> 11556 public class PriorityQueue
11566 { 11557 {
11567 internal delegate bool UpdatePriorityHandler(ref TPriority priority, uint local_id); 11558 internal delegate bool UpdatePriorityHandler(ref double priority, uint local_id);
11568 11559
11569 private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[1]; 11560 private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[1];
11570 private Dictionary<uint, LookupItem> m_lookupTable; 11561 private Dictionary<uint, LookupItem> m_lookupTable;
11571 private Comparison<TPriority> m_comparison; 11562 private Comparison<double> m_comparison;
11572 private object m_syncRoot = new object(); 11563 private object m_syncRoot = new object();
11573 11564
11574 internal PriorityQueue() : 11565 internal PriorityQueue() :
11575 this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, Comparer<TPriority>.Default) { } 11566 this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, Comparer<double>.Default) { }
11576 internal PriorityQueue(int capacity) : 11567 internal PriorityQueue(int capacity) :
11577 this(capacity, Comparer<TPriority>.Default) { } 11568 this(capacity, Comparer<double>.Default) { }
11578 internal PriorityQueue(IComparer<TPriority> comparer) : 11569 internal PriorityQueue(IComparer<double> comparer) :
11579 this(new Comparison<TPriority>(comparer.Compare)) { } 11570 this(new Comparison<double>(comparer.Compare)) { }
11580 internal PriorityQueue(Comparison<TPriority> comparison) : 11571 internal PriorityQueue(Comparison<double> comparison) :
11581 this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, comparison) { } 11572 this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, comparison) { }
11582 internal PriorityQueue(int capacity, IComparer<TPriority> comparer) : 11573 internal PriorityQueue(int capacity, IComparer<double> comparer) :
11583 this(capacity, new Comparison<TPriority>(comparer.Compare)) { } 11574 this(capacity, new Comparison<double>(comparer.Compare)) { }
11584 internal PriorityQueue(int capacity, Comparison<TPriority> comparison) 11575 internal PriorityQueue(int capacity, Comparison<double> comparison)
11585 { 11576 {
11586 m_lookupTable = new Dictionary<uint, LookupItem>(capacity); 11577 m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
11587 11578
@@ -11602,12 +11593,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11602 } 11593 }
11603 } 11594 }
11604 11595
11605 public bool Enqueue(TPriority priority, TValue value, uint local_id) 11596 public bool Enqueue(double priority, EntityUpdate value, uint local_id)
11606 { 11597 {
11607 LookupItem item; 11598 LookupItem item;
11608 11599
11609 if (m_lookupTable.TryGetValue(local_id, out item)) 11600 if (m_lookupTable.TryGetValue(local_id, out item))
11610 { 11601 {
11602 // Combine flags
11603 value.Flags |= item.Heap[item.Handle].Value.Flags;
11604
11611 item.Heap[item.Handle] = new MinHeapItem(priority, value, local_id, this.m_comparison); 11605 item.Heap[item.Handle] = new MinHeapItem(priority, value, local_id, this.m_comparison);
11612 return false; 11606 return false;
11613 } 11607 }
@@ -11620,7 +11614,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11620 } 11614 }
11621 } 11615 }
11622 11616
11623 internal TValue Peek() 11617 internal EntityUpdate Peek()
11624 { 11618 {
11625 for (int i = 0; i < m_heaps.Length; ++i) 11619 for (int i = 0; i < m_heaps.Length; ++i)
11626 if (m_heaps[i].Count > 0) 11620 if (m_heaps[i].Count > 0)
@@ -11628,7 +11622,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11628 throw new InvalidOperationException(string.Format("The {0} is empty", this.GetType().ToString())); 11622 throw new InvalidOperationException(string.Format("The {0} is empty", this.GetType().ToString()));
11629 } 11623 }
11630 11624
11631 internal bool TryDequeue(out TValue value) 11625 internal bool TryDequeue(out EntityUpdate value)
11632 { 11626 {
11633 for (int i = 0; i < m_heaps.Length; ++i) 11627 for (int i = 0; i < m_heaps.Length; ++i)
11634 { 11628 {
@@ -11641,14 +11635,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11641 } 11635 }
11642 } 11636 }
11643 11637
11644 value = default(TValue); 11638 value = default(EntityUpdate);
11645 return false; 11639 return false;
11646 } 11640 }
11647 11641
11648 internal void Reprioritize(UpdatePriorityHandler handler) 11642 internal void Reprioritize(UpdatePriorityHandler handler)
11649 { 11643 {
11650 MinHeapItem item; 11644 MinHeapItem item;
11651 TPriority priority; 11645 double priority;
11652 11646
11653 foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values)) 11647 foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
11654 { 11648 {
@@ -11674,16 +11668,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11674 #region MinHeapItem 11668 #region MinHeapItem
11675 private struct MinHeapItem : IComparable<MinHeapItem> 11669 private struct MinHeapItem : IComparable<MinHeapItem>
11676 { 11670 {
11677 private TPriority priority; 11671 private double priority;
11678 private TValue value; 11672 private EntityUpdate value;
11679 private uint local_id; 11673 private uint local_id;
11680 private Comparison<TPriority> comparison; 11674 private Comparison<double> comparison;
11681 11675
11682 internal MinHeapItem(TPriority priority, TValue value, uint local_id) : 11676 internal MinHeapItem(double priority, EntityUpdate value, uint local_id) :
11683 this(priority, value, local_id, Comparer<TPriority>.Default) { } 11677 this(priority, value, local_id, Comparer<double>.Default) { }
11684 internal MinHeapItem(TPriority priority, TValue value, uint local_id, IComparer<TPriority> comparer) : 11678 internal MinHeapItem(double priority, EntityUpdate value, uint local_id, IComparer<double> comparer) :
11685 this(priority, value, local_id, new Comparison<TPriority>(comparer.Compare)) { } 11679 this(priority, value, local_id, new Comparison<double>(comparer.Compare)) { }
11686 internal MinHeapItem(TPriority priority, TValue value, uint local_id, Comparison<TPriority> comparison) 11680 internal MinHeapItem(double priority, EntityUpdate value, uint local_id, Comparison<double> comparison)
11687 { 11681 {
11688 this.priority = priority; 11682 this.priority = priority;
11689 this.value = value; 11683 this.value = value;
@@ -11691,8 +11685,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11691 this.comparison = comparison; 11685 this.comparison = comparison;
11692 } 11686 }
11693 11687
11694 internal TPriority Priority { get { return this.priority; } } 11688 internal double Priority { get { return this.priority; } }
11695 internal TValue Value { get { return this.value; } } 11689 internal EntityUpdate Value { get { return this.value; } }
11696 internal uint LocalID { get { return this.local_id; } } 11690 internal uint LocalID { get { return this.local_id; } }
11697 11691
11698 public override string ToString() 11692 public override string ToString()