aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Prioritizer.cs
diff options
context:
space:
mode:
authorMelanie2011-04-25 23:26:37 +0100
committerMelanie2011-04-25 23:26:37 +0100
commita6c53b1ba281e187b3e815ff7c416a0ce5ff04e1 (patch)
treea71aa6ca35f2ccb1a410d9688616f4092c8d5e48 /OpenSim/Region/Framework/Scenes/Prioritizer.cs
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentMerge branch 'master' into queuetest (diff)
downloadopensim-SC_OLD-a6c53b1ba281e187b3e815ff7c416a0ce5ff04e1.zip
opensim-SC_OLD-a6c53b1ba281e187b3e815ff7c416a0ce5ff04e1.tar.gz
opensim-SC_OLD-a6c53b1ba281e187b3e815ff7c416a0ce5ff04e1.tar.bz2
opensim-SC_OLD-a6c53b1ba281e187b3e815ff7c416a0ce5ff04e1.tar.xz
Merge branch 'queuetest' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Prioritizer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs34
1 files changed, 30 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 17b2da1..ef78f0f 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes
88 88
89 // If this is an update for our own avatar give it the highest priority 89 // If this is an update for our own avatar give it the highest priority
90 if (client.AgentId == entity.UUID) 90 if (client.AgentId == entity.UUID)
91 return PriorityQueue.ImmediateQueue; 91 return 0;
92 92
93 uint priority; 93 uint priority;
94 94
@@ -119,16 +119,40 @@ namespace OpenSim.Region.Framework.Scenes
119 119
120 private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) 120 private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity)
121 { 121 {
122 return 1; 122 // And anything attached to this avatar gets top priority as well
123 if (entity is SceneObjectPart)
124 {
125 SceneObjectPart sop = (SceneObjectPart)entity;
126 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
127 return 1;
128 }
129
130 return PriorityQueue.NumberOfImmediateQueues; // first queue past the immediate queues
123 } 131 }
124 132
125 private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) 133 private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
126 { 134 {
135 // And anything attached to this avatar gets top priority as well
136 if (entity is SceneObjectPart)
137 {
138 SceneObjectPart sop = (SceneObjectPart)entity;
139 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
140 return 1;
141 }
142
127 return ComputeDistancePriority(client,entity,false); 143 return ComputeDistancePriority(client,entity,false);
128 } 144 }
129 145
130 private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) 146 private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
131 { 147 {
148 // And anything attached to this avatar gets top priority as well
149 if (entity is SceneObjectPart)
150 {
151 SceneObjectPart sop = (SceneObjectPart)entity;
152 if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar)
153 return 1;
154 }
155
132 return ComputeDistancePriority(client,entity,true); 156 return ComputeDistancePriority(client,entity,true);
133 } 157 }
134 158
@@ -205,8 +229,10 @@ namespace OpenSim.Region.Framework.Scenes
205 229
206 // And convert the distance to a priority queue, this computation gives queues 230 // And convert the distance to a priority queue, this computation gives queues
207 // at 10, 20, 40, 80, 160, 320, 640, and 1280m 231 // at 10, 20, 40, 80, 160, 320, 640, and 1280m
208 uint pqueue = 1; 232 uint pqueue = PriorityQueue.NumberOfImmediateQueues;
209 for (int i = 0; i < 8; i++) 233 uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues;
234
235 for (int i = 0; i < queues - 1; i++)
210 { 236 {
211 if (distance < 10 * Math.Pow(2.0,i)) 237 if (distance < 10 * Math.Pow(2.0,i))
212 break; 238 break;