aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-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 cddc7b2..b2a80be 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
@@ -439,7 +438,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
439 438
440 m_scene = scene; 439 m_scene = scene;
441 440
442 m_entityUpdates = new PriorityQueue<double, EntityUpdate>(m_scene.Entities.Count); 441 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
443 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); 442 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
444 m_killRecord = new HashSet<uint>(); 443 m_killRecord = new HashSet<uint>();
445 444
@@ -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));
@@ -11592,26 +11583,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11592 } 11583 }
11593 11584
11594 #region PriorityQueue 11585 #region PriorityQueue
11595 public class PriorityQueue<TPriority, TValue> 11586 public class PriorityQueue
11596 { 11587 {
11597 internal delegate bool UpdatePriorityHandler(ref TPriority priority, uint local_id); 11588 internal delegate bool UpdatePriorityHandler(ref double priority, uint local_id);
11598 11589
11599 private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[1]; 11590 private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[1];
11600 private Dictionary<uint, LookupItem> m_lookupTable; 11591 private Dictionary<uint, LookupItem> m_lookupTable;
11601 private Comparison<TPriority> m_comparison; 11592 private Comparison<double> m_comparison;
11602 private object m_syncRoot = new object(); 11593 private object m_syncRoot = new object();
11603 11594
11604 internal PriorityQueue() : 11595 internal PriorityQueue() :
11605 this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, Comparer<TPriority>.Default) { } 11596 this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, Comparer<double>.Default) { }
11606 internal PriorityQueue(int capacity) : 11597 internal PriorityQueue(int capacity) :
11607 this(capacity, Comparer<TPriority>.Default) { } 11598 this(capacity, Comparer<double>.Default) { }
11608 internal PriorityQueue(IComparer<TPriority> comparer) : 11599 internal PriorityQueue(IComparer<double> comparer) :
11609 this(new Comparison<TPriority>(comparer.Compare)) { } 11600 this(new Comparison<double>(comparer.Compare)) { }
11610 internal PriorityQueue(Comparison<TPriority> comparison) : 11601 internal PriorityQueue(Comparison<double> comparison) :
11611 this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, comparison) { } 11602 this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, comparison) { }
11612 internal PriorityQueue(int capacity, IComparer<TPriority> comparer) : 11603 internal PriorityQueue(int capacity, IComparer<double> comparer) :
11613 this(capacity, new Comparison<TPriority>(comparer.Compare)) { } 11604 this(capacity, new Comparison<double>(comparer.Compare)) { }
11614 internal PriorityQueue(int capacity, Comparison<TPriority> comparison) 11605 internal PriorityQueue(int capacity, Comparison<double> comparison)
11615 { 11606 {
11616 m_lookupTable = new Dictionary<uint, LookupItem>(capacity); 11607 m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
11617 11608
@@ -11632,12 +11623,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11632 } 11623 }
11633 } 11624 }
11634 11625
11635 public bool Enqueue(TPriority priority, TValue value, uint local_id) 11626 public bool Enqueue(double priority, EntityUpdate value, uint local_id)
11636 { 11627 {
11637 LookupItem item; 11628 LookupItem item;
11638 11629
11639 if (m_lookupTable.TryGetValue(local_id, out item)) 11630 if (m_lookupTable.TryGetValue(local_id, out item))
11640 { 11631 {
11632 // Combine flags
11633 value.Flags |= item.Heap[item.Handle].Value.Flags;
11634
11641 item.Heap[item.Handle] = new MinHeapItem(priority, value, local_id, this.m_comparison); 11635 item.Heap[item.Handle] = new MinHeapItem(priority, value, local_id, this.m_comparison);
11642 return false; 11636 return false;
11643 } 11637 }
@@ -11650,7 +11644,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11650 } 11644 }
11651 } 11645 }
11652 11646
11653 internal TValue Peek() 11647 internal EntityUpdate Peek()
11654 { 11648 {
11655 for (int i = 0; i < m_heaps.Length; ++i) 11649 for (int i = 0; i < m_heaps.Length; ++i)
11656 if (m_heaps[i].Count > 0) 11650 if (m_heaps[i].Count > 0)
@@ -11658,7 +11652,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11658 throw new InvalidOperationException(string.Format("The {0} is empty", this.GetType().ToString())); 11652 throw new InvalidOperationException(string.Format("The {0} is empty", this.GetType().ToString()));
11659 } 11653 }
11660 11654
11661 internal bool TryDequeue(out TValue value) 11655 internal bool TryDequeue(out EntityUpdate value)
11662 { 11656 {
11663 for (int i = 0; i < m_heaps.Length; ++i) 11657 for (int i = 0; i < m_heaps.Length; ++i)
11664 { 11658 {
@@ -11671,14 +11665,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11671 } 11665 }
11672 } 11666 }
11673 11667
11674 value = default(TValue); 11668 value = default(EntityUpdate);
11675 return false; 11669 return false;
11676 } 11670 }
11677 11671
11678 internal void Reprioritize(UpdatePriorityHandler handler) 11672 internal void Reprioritize(UpdatePriorityHandler handler)
11679 { 11673 {
11680 MinHeapItem item; 11674 MinHeapItem item;
11681 TPriority priority; 11675 double priority;
11682 11676
11683 foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values)) 11677 foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
11684 { 11678 {
@@ -11704,16 +11698,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11704 #region MinHeapItem 11698 #region MinHeapItem
11705 private struct MinHeapItem : IComparable<MinHeapItem> 11699 private struct MinHeapItem : IComparable<MinHeapItem>
11706 { 11700 {
11707 private TPriority priority; 11701 private double priority;
11708 private TValue value; 11702 private EntityUpdate value;
11709 private uint local_id; 11703 private uint local_id;
11710 private Comparison<TPriority> comparison; 11704 private Comparison<double> comparison;
11711 11705
11712 internal MinHeapItem(TPriority priority, TValue value, uint local_id) : 11706 internal MinHeapItem(double priority, EntityUpdate value, uint local_id) :
11713 this(priority, value, local_id, Comparer<TPriority>.Default) { } 11707 this(priority, value, local_id, Comparer<double>.Default) { }
11714 internal MinHeapItem(TPriority priority, TValue value, uint local_id, IComparer<TPriority> comparer) : 11708 internal MinHeapItem(double priority, EntityUpdate value, uint local_id, IComparer<double> comparer) :
11715 this(priority, value, local_id, new Comparison<TPriority>(comparer.Compare)) { } 11709 this(priority, value, local_id, new Comparison<double>(comparer.Compare)) { }
11716 internal MinHeapItem(TPriority priority, TValue value, uint local_id, Comparison<TPriority> comparison) 11710 internal MinHeapItem(double priority, EntityUpdate value, uint local_id, Comparison<double> comparison)
11717 { 11711 {
11718 this.priority = priority; 11712 this.priority = priority;
11719 this.value = value; 11713 this.value = value;
@@ -11721,8 +11715,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11721 this.comparison = comparison; 11715 this.comparison = comparison;
11722 } 11716 }
11723 11717
11724 internal TPriority Priority { get { return this.priority; } } 11718 internal double Priority { get { return this.priority; } }
11725 internal TValue Value { get { return this.value; } } 11719 internal EntityUpdate Value { get { return this.value; } }
11726 internal uint LocalID { get { return this.local_id; } } 11720 internal uint LocalID { get { return this.local_id; } }
11727 11721
11728 public override string ToString() 11722 public override string ToString()