reserve updates priority queue 2 for attachments, send them by it on

BestAvatarResp scheme. Attachments cannot be sent on imediate queues,
 since they will block everything. Changed distance to priority math,
 keeping identical result, shifted to start at queue 3.
avinationmerge
UbitUmarov 2014-08-20 21:41:16 +01:00
parent 542118adf1
commit 88587b4e73
2 changed files with 19 additions and 5 deletions

View File

@ -62,7 +62,9 @@ namespace OpenSim.Framework
private uint m_nextQueue = 0; private uint m_nextQueue = 0;
private uint m_countFromQueue = 0; private uint m_countFromQueue = 0;
// first queues are imediate, so no counts // first queues are imediate, so no counts
private uint[] m_queueCounts = {0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1}; // private uint[] m_queueCounts = { 0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1 };
private uint[] m_queueCounts = {0, 0, 8, 8, 5, 4, 3, 2, 1, 1, 1, 1};
// this is ava, ava, attach, <10m, 20,40,80,160m,320,640,1280, +
// next request is a counter of the number of updates queued, it provides // next request is a counter of the number of updates queued, it provides
// a total ordering on the updates coming through the queue and is more // a total ordering on the updates coming through the queue and is more

View File

@ -175,7 +175,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// Attachments are high priority, // Attachments are high priority,
if (((SceneObjectPart)entity).ParentGroup.IsAttachment) if (((SceneObjectPart)entity).ParentGroup.IsAttachment)
return 1; return 2;
pqueue = ComputeDistancePriority(client, entity, false); pqueue = ComputeDistancePriority(client, entity, false);
@ -233,15 +233,27 @@ namespace OpenSim.Region.Framework.Scenes
// And convert the distance to a priority queue, this computation gives queues // And convert the distance to a priority queue, this computation gives queues
// at 10, 20, 40, 80, 160, 320, 640, and 1280m // at 10, 20, 40, 80, 160, 320, 640, and 1280m
uint pqueue = PriorityQueue.NumberOfImmediateQueues; uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue
uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues;
/*
for (int i = 0; i < queues - 1; i++) for (int i = 0; i < queues - 1; i++)
{ {
if (distance < 30 * Math.Pow(2.0,i)) if (distance < 30 * Math.Pow(2.0,i))
break; break;
pqueue++; pqueue++;
} }
*/
if (distance > 10f)
{
float tmp = (float)Math.Log((double)distance) * 1.4426950408889634073599246810019f - 3.3219280948873623478703194294894f;
// for a map identical to original:
// now
// 1st constant is 1/(log(2)) (natural log) so we get log2(distance)
// 2st constant makes it be log2(distance/10)
pqueue += (uint)tmp;
if (pqueue > queues - 1)
pqueue = queues - 1;
}
// If this is a root agent, then determine front & back // If this is a root agent, then determine front & back
// Bump up the priority queue (drop the priority) for any objects behind the avatar // Bump up the priority queue (drop the priority) for any objects behind the avatar