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).

afrisby
MW 2007-09-06 14:15:16 +00:00
parent 3586beb81b
commit 804e87861b
4 changed files with 123 additions and 13 deletions

View File

@ -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":

View File

@ -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);
}
}
/// <summary>
///
/// </summary>

View File

@ -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<ScenePresence> 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);
}
/// <summary>
///
/// </summary>
@ -649,6 +663,22 @@ namespace OpenSim.Region.Environment.Scenes
m_text, ParentID, this.m_particleSystem, lRot);
}
/// Terse updates
public void AddTerseUpdateToAllAvatars()
{
List<ScenePresence> 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);
}
/// <summary>
///
/// </summary>

View File

@ -88,6 +88,12 @@ namespace OpenSim.Region.Environment.Scenes
public delegate void SignificantClientMovement(IClientAPI remote_client);
public event SignificantClientMovement OnSignificantClientMovement;
// private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>();
// private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>();
private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>();
private Queue<SceneObjectPart> m_teserPartUpdates = new Queue<SceneObjectPart>();
#region Properties
/// <summary>
///
@ -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
/// <summary>
/// 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
/// </summary>
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