SimpleAngularDistance update prioritization scheme ameks no sense without ordered dequeue of the updates

0.9.0-post-fixes
UbitUmarov 2017-07-10 22:01:38 +01:00
parent f8cdccc167
commit 40b16f1705
2 changed files with 47 additions and 4 deletions

View File

@ -216,6 +216,27 @@ namespace OpenSim.Framework
return false;
}
public bool TryOrderedDequeue(out EntityUpdate value, out Int32 timeinqueue)
{
// If there is anything in imediate queues, return it first no
// matter what else. Breaks fairness. But very useful.
for (int iq = 0; iq < NumberOfQueues; iq++)
{
if (m_heaps[iq].Count > 0)
{
MinHeapItem item = m_heaps[iq].RemoveMin();
m_lookupTable.Remove(item.Value.Entity.LocalId);
timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
value = item.Value;
return true;
}
}
timeinqueue = 0;
value = default(EntityUpdate);
return false;
}
/// <summary>
/// Reapply the prioritization function to each of the updates currently
/// stored in the priority queues.

View File

@ -4137,6 +4137,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Vector3 mypos = Vector3.Zero;
ScenePresence mysp = (ScenePresence)SceneAgent;
bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance;
// we should have a presence
if(mysp == null)
return;
@ -4151,8 +4152,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
while (maxUpdatesBytes > 0)
{
lock (m_entityUpdates.SyncRoot)
if (!m_entityUpdates.TryDequeue(out update, out timeinqueue))
break;
{
if(orderedDequeue)
{
if (!m_entityUpdates.TryOrderedDequeue(out update, out timeinqueue))
break;
}
else
{
if (!m_entityUpdates.TryDequeue(out update, out timeinqueue))
break;
}
}
PrimUpdateFlags updateFlags = (PrimUpdateFlags)update.Flags;
@ -4850,6 +4861,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>> propertyUpdates =
// new OpenSim.Framework.Lazy<List<ObjectPropertyUpdate>>();
bool orderedDequeue = m_scene.UpdatePrioritizationScheme == UpdatePrioritizationSchemes.SimpleAngularDistance;
EntityUpdate iupdate;
Int32 timeinqueue; // this is just debugging code & can be dropped later
@ -4857,8 +4869,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
while (maxUpdateBytes > 0)
{
lock (m_entityProps.SyncRoot)
if (!m_entityProps.TryDequeue(out iupdate, out timeinqueue))
break;
{
if(orderedDequeue)
{
if (!m_entityProps.TryOrderedDequeue(out iupdate, out timeinqueue))
break;
}
else
{
if (!m_entityProps.TryDequeue(out iupdate, out timeinqueue))
break;
}
}
ObjectPropertyUpdate update = (ObjectPropertyUpdate)iupdate;
if (update.SendFamilyProps)