diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index b2a80be..3888a0b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -50,18 +50,6 @@ using Nini.Config; | |||
50 | 50 | ||
51 | namespace OpenSim.Region.ClientStack.LindenUDP | 51 | namespace OpenSim.Region.ClientStack.LindenUDP |
52 | { | 52 | { |
53 | public class EntityUpdate | ||
54 | { | ||
55 | public ISceneEntity Entity; | ||
56 | public PrimUpdateFlags Flags; | ||
57 | |||
58 | public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags) | ||
59 | { | ||
60 | Entity = entity; | ||
61 | Flags = flags; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); | 53 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); |
66 | 54 | ||
67 | /// <summary> | 55 | /// <summary> |
@@ -325,6 +313,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
325 | 313 | ||
326 | private int m_cachedTextureSerial; | 314 | private int m_cachedTextureSerial; |
327 | private PriorityQueue m_entityUpdates; | 315 | private PriorityQueue m_entityUpdates; |
316 | private Prioritizer m_prioritizer; | ||
328 | 317 | ||
329 | /// <value> | 318 | /// <value> |
330 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | 319 | /// List used in construction of data blocks for an object update packet. This is to stop us having to |
@@ -465,6 +454,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
465 | m_propertiesPacketTimer = new Timer(100); | 454 | m_propertiesPacketTimer = new Timer(100); |
466 | m_propertiesPacketTimer.Elapsed += ProcessObjectPropertiesPacket; | 455 | m_propertiesPacketTimer.Elapsed += ProcessObjectPropertiesPacket; |
467 | 456 | ||
457 | m_prioritizer = new Prioritizer(m_scene); | ||
458 | |||
468 | RegisterLocalPacketHandlers(); | 459 | RegisterLocalPacketHandlers(); |
469 | } | 460 | } |
470 | 461 | ||
@@ -3457,14 +3448,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3457 | /// </summary> | 3448 | /// </summary> |
3458 | public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3449 | public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3459 | { | 3450 | { |
3460 | double priority; | 3451 | double priority = m_prioritizer.GetUpdatePriority(this, entity); |
3461 | |||
3462 | if (entity is SceneObjectPart) | ||
3463 | priority = ((SceneObjectPart)entity).ParentGroup.GetUpdatePriority(this); | ||
3464 | else if (entity is ScenePresence) | ||
3465 | priority = ((ScenePresence)entity).GetUpdatePriority(this); | ||
3466 | else | ||
3467 | priority = 0.0d; | ||
3468 | 3452 | ||
3469 | lock (m_entityUpdates.SyncRoot) | 3453 | lock (m_entityUpdates.SyncRoot) |
3470 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); | 3454 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); |
@@ -3613,19 +3597,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3613 | #endregion Packet Sending | 3597 | #endregion Packet Sending |
3614 | } | 3598 | } |
3615 | 3599 | ||
3616 | public void ReprioritizeUpdates(UpdatePriorityHandler handler) | 3600 | public void ReprioritizeUpdates() |
3617 | { | 3601 | { |
3618 | //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName); | 3602 | //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName); |
3619 | 3603 | ||
3620 | PriorityQueue.UpdatePriorityHandler update_priority_handler = | ||
3621 | delegate(ref double priority, uint local_id) | ||
3622 | { | ||
3623 | priority = handler(new UpdatePriorityData(priority, local_id)); | ||
3624 | return priority != double.NaN; | ||
3625 | }; | ||
3626 | |||
3627 | lock (m_entityUpdates.SyncRoot) | 3604 | lock (m_entityUpdates.SyncRoot) |
3628 | m_entityUpdates.Reprioritize(update_priority_handler); | 3605 | m_entityUpdates.Reprioritize(UpdatePriorityHandler); |
3606 | } | ||
3607 | |||
3608 | private bool UpdatePriorityHandler(ref double priority, uint localID) | ||
3609 | { | ||
3610 | EntityBase entity; | ||
3611 | if (m_scene.Entities.TryGetValue(localID, out entity)) | ||
3612 | { | ||
3613 | priority = m_prioritizer.GetUpdatePriority(this, entity); | ||
3614 | } | ||
3615 | |||
3616 | return priority != double.NaN; | ||
3629 | } | 3617 | } |
3630 | 3618 | ||
3631 | public void FlushPrimUpdates() | 3619 | public void FlushPrimUpdates() |