From 804e87861b95f08590cff8a84a4b9955f1750452 Mon Sep 17 00:00:00 2001
From: MW
Date: Thu, 6 Sep 2007 14:15:16 +0000
Subject: added experimental method of trying to relieve missing prim problem
(by adding a limit of the number of prim update packets sent in each update
loop).
---
OpenSim/Region/Environment/Scenes/Scene.cs | 26 ++++++----
.../Region/Environment/Scenes/SceneObjectGroup.cs | 16 ++++++
.../Region/Environment/Scenes/SceneObjectPart.cs | 34 +++++++++++-
OpenSim/Region/Environment/Scenes/ScenePresence.cs | 60 +++++++++++++++++++++-
4 files changed, 123 insertions(+), 13 deletions(-)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 4e87032..4151074 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -928,13 +928,14 @@ namespace OpenSim.Region.Environment.Scenes
}
}
- public void SendAllSceneObjectsToClient(IClientAPI client)
+ public void SendAllSceneObjectsToClient(ScenePresence presence)
{
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
- ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
+ // ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
+ ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
}
}
}
@@ -1229,6 +1230,17 @@ namespace OpenSim.Region.Environment.Scenes
}
#endregion
+ private void forceClientUpdate()
+ {
+ foreach (EntityBase ent in this.Entities.Values)
+ {
+ if (ent is SceneObjectGroup)
+ {
+ ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
+ }
+ }
+ }
+
public void ProcessConsoleCmd(string command, string[] cmdparams)
{
switch (command)
@@ -1243,12 +1255,14 @@ namespace OpenSim.Region.Environment.Scenes
MainLog.Instance.Error("show users - show info about connected users in the current region.");
MainLog.Instance.Error("shutdown - disconnect all clients and shutdown.");
break;
+
case "show":
if (cmdparams.Length > 0)
{
Show(cmdparams[0]);
}
break;
+
case "save-xml":
if (cmdparams.Length > 0)
{
@@ -1277,13 +1291,7 @@ namespace OpenSim.Region.Environment.Scenes
case "force-update":
Console.WriteLine("Updating all clients");
- foreach(EntityBase ent in this.Entities.Values)
- {
- if (ent is SceneObjectGroup)
- {
- ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
- }
- }
+ this.forceClientUpdate();
break;
case "backup":
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 1869a63..b202f3c 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -347,6 +347,22 @@ namespace OpenSim.Region.Environment.Scenes
}
}
+ public void ScheduleFullUpdateToAvatar(ScenePresence presence)
+ {
+ foreach (SceneObjectPart part in this.m_parts.Values)
+ {
+ part.AddFullUpdateToAvatar(presence);
+ }
+ }
+
+ public void ScheduleTerseUpdateToAvatar(ScenePresence presence)
+ {
+ foreach (SceneObjectPart part in this.m_parts.Values)
+ {
+ part.AddTerseUpdateToAvatar(presence);
+ }
+ }
+
///
///
///
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 65a995a..dec017e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -391,14 +391,14 @@ namespace OpenSim.Region.Environment.Scenes
{
if (m_updateFlag == 1) //some change has been made so update the clients
{
- SendTerseUpdateToAllClients();
+ AddTerseUpdateToAllAvatars();
ClearUpdateSchedule();
}
else
{
if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
{
- SendFullUpdateToAllClients();
+ AddFullUpdateToAllAvatars();
ClearUpdateSchedule();
}
}
@@ -603,6 +603,20 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region Client Update Methods
+ public void AddFullUpdateToAllAvatars()
+ {
+ List avatars = this.m_parentGroup.RequestSceneAvatars();
+ for (int i = 0; i < avatars.Count; i++)
+ {
+ avatars[i].AddFullPart(this);
+ }
+ }
+
+ public void AddFullUpdateToAvatar(ScenePresence presence)
+ {
+ presence.AddFullPart(this);
+ }
+
///
///
///
@@ -649,6 +663,22 @@ namespace OpenSim.Region.Environment.Scenes
m_text, ParentID, this.m_particleSystem, lRot);
}
+ /// Terse updates
+
+ public void AddTerseUpdateToAllAvatars()
+ {
+ List avatars = this.m_parentGroup.RequestSceneAvatars();
+ for (int i = 0; i < avatars.Count; i++)
+ {
+ avatars[i].AddTersePart(this);
+ }
+ }
+
+ public void AddTerseUpdateToAvatar(ScenePresence presence)
+ {
+ presence.AddTersePart(this);
+ }
+
///
///
///
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index e094ac6..285c691 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -88,6 +88,12 @@ namespace OpenSim.Region.Environment.Scenes
public delegate void SignificantClientMovement(IClientAPI remote_client);
public event SignificantClientMovement OnSignificantClientMovement;
+ // private Queue m_fullGroupUpdates = new Queue();
+ // private Queue m_terseGroupUpdates = new Queue();
+
+ private Queue m_fullPartUpdates = new Queue();
+ private Queue m_teserPartUpdates = new Queue();
+
#region Properties
///
///
@@ -193,6 +199,54 @@ namespace OpenSim.Region.Environment.Scenes
}
#endregion
+ public void AddTersePart(SceneObjectPart part)
+ {
+ m_teserPartUpdates.Enqueue(part);
+ }
+
+ public void AddFullPart(SceneObjectPart part)
+ {
+ m_fullPartUpdates.Enqueue(part);
+ }
+
+ public void SendPrimUpdates()
+ {
+ if (m_teserPartUpdates.Count > 0)
+ {
+ bool terse = true;
+ int terseCount = 0;
+
+ while (terse)
+ {
+ SceneObjectPart part = m_teserPartUpdates.Dequeue();
+ part.SendTerseUpdate(this.ControllingClient);
+ terseCount++;
+
+ if ((m_teserPartUpdates.Count < 1) |(terseCount > 30))
+ {
+ terse = false;
+ }
+ }
+ }
+ if (m_fullPartUpdates.Count > 0)
+ {
+ bool full = true;
+ int fullCount = 0;
+
+ while (full)
+ {
+ SceneObjectPart part = m_fullPartUpdates.Dequeue();
+ part.SendFullUpdate(this.ControllingClient);
+ fullCount++;
+ if ((m_fullPartUpdates.Count < 1) | (fullCount > 40))
+ {
+ full = false;
+ }
+
+ }
+ }
+ }
+
#region Status Methods
///
/// Not Used, most likely can be deleted
@@ -221,7 +275,7 @@ namespace OpenSim.Region.Environment.Scenes
this._physActor.Flying = isFlying;
this.newAvatar = true;
this.childAgent = false;
- this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
+ this.m_scene.SendAllSceneObjectsToClient(this);
}
protected void MakeChildAgent()
@@ -399,6 +453,8 @@ namespace OpenSim.Region.Environment.Scenes
///
public override void Update()
{
+ this.SendPrimUpdates();
+
if (this.childAgent == false)
{
if (this.newForce)
@@ -500,7 +556,7 @@ namespace OpenSim.Region.Environment.Scenes
//this.SendFullUpdateToALLClients();
//this.SendArrearanceToAllOtherAgents();
- this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
+ this.m_scene.SendAllSceneObjectsToClient(this);
this.ControllingClient.SendViewerTime(this.m_scene.TimePhase);
//Please don't remove the following code (at least not yet), just leave it commented out
--
cgit v1.1