* Added a way for the sim stats reporter to say to the scene that the stats are illogical.

0.6.2-post-fixes
Teravus Ovares 2009-01-06 00:07:24 +00:00
parent 0c3426935e
commit 0d1b867500
3 changed files with 47 additions and 5 deletions

View File

@ -360,6 +360,7 @@ namespace OpenSim.Region.Environment.Scenes
StatsReporter = new SimStatsReporter(this);
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
StatsReporter.SetObjectCapacity(objectCapacity);

View File

@ -694,6 +694,24 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void RecalculateStats()
{
List<ScenePresence> SPList = GetScenePresences();
int rootcount = 0;
int childcount = 0;
foreach (ScenePresence user in SPList)
{
if (user.IsChildAgent)
childcount++;
else
rootcount++;
}
m_numRootAgents = rootcount;
m_numChildAgents = childcount;
}
public int GetChildAgentCount()
{
// some network situations come in where child agents get closed twice.
@ -1748,5 +1766,7 @@ namespace OpenSim.Region.Environment.Scenes
}
#endregion
}
}

View File

@ -39,10 +39,16 @@ namespace OpenSim.Region.Environment.Scenes
{
public delegate void SendStatResult(SimStats stats);
public delegate void YourStatsAreWrong();
public event SendStatResult OnSendStatsResult;
public event YourStatsAreWrong OnStatsIncorrect;
private SendStatResult handlerSendStatResult = null;
private YourStatsAreWrong handlerStatsIncorrect = null;
private enum Stats : uint
{
TimeDilation = 0,
@ -306,15 +312,30 @@ namespace OpenSim.Region.Environment.Scenes
public void SetRootAgents(int rootAgents)
{
m_rootAgents = rootAgents;
CheckStatSanity();
}
internal void CheckStatSanity()
{
if (m_rootAgents < 0 || m_childAgents < 0)
{
handlerStatsIncorrect = OnStatsIncorrect;
if (handlerStatsIncorrect != null)
{
handlerStatsIncorrect();
}
}
if (m_rootAgents == 0 && m_childAgents == 0)
{
m_unAckedBytes = 0;
}
}
public void SetChildAgents(int childAgents)
{
m_childAgents = (childAgents > 0) ? childAgents : 0;
if (childAgents < 0)
{
//List<ScenePresence> avs= m_scene.GetScenePresences();
}
m_childAgents = childAgents;
CheckStatSanity();
}
public void SetObjects(int objects)