Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
commit
4bf1598930
|
@ -192,7 +192,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
|
||||
protected string RegionStats(OSHttpResponse httpResponse, Scene scene)
|
||||
{
|
||||
int users = scene.GetAvatars().Count;
|
||||
int users = scene.GetRootAgentCount();
|
||||
int objects = scene.Entities.Count - users;
|
||||
|
||||
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString());
|
||||
rxw.WriteEndAttribute();
|
||||
|
||||
int users = s.GetAvatars().Count;
|
||||
int users = s.GetRootAgentCount();
|
||||
rxw.WriteStartAttribute(String.Empty, "avatars", String.Empty);
|
||||
rxw.WriteValue(users);
|
||||
rxw.WriteEndAttribute();
|
||||
|
|
|
@ -4362,6 +4362,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return m_sceneGraph.GetAvatars();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cheaply return the number of avatars in a region (without fetching a list object)
|
||||
/// </summary>
|
||||
public int GetRootAgentCount()
|
||||
{
|
||||
return m_sceneGraph.GetRootAgentCount();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a list of all ScenePresences in this region. This returns child agents as well as root agents.
|
||||
/// This list is a new object, so it can be iterated over without locking.
|
||||
|
|
|
@ -104,8 +104,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// since the group's last persistent backup
|
||||
/// </summary>
|
||||
private bool m_hasGroupChanged = false;
|
||||
private long timeFirstChanged;
|
||||
private long timeLastChanged;
|
||||
private long timeFirstChanged = 0;
|
||||
private long timeLastChanged = 0;
|
||||
long m_maxPersistTime = 0;
|
||||
long m_minPersistTime = 0;
|
||||
Random m_rand;
|
||||
|
||||
private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim();
|
||||
|
||||
public void lockPartsForRead(bool locked)
|
||||
|
@ -182,6 +186,28 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
timeLastChanged = DateTime.Now.Ticks;
|
||||
if (!m_hasGroupChanged)
|
||||
timeFirstChanged = DateTime.Now.Ticks;
|
||||
if (m_rand == null)
|
||||
{
|
||||
byte[] val = new byte[16];
|
||||
m_rootPart.UUID.ToBytes(val, 0);
|
||||
m_rand = new Random(BitConverter.ToInt32(val, 0));
|
||||
}
|
||||
if (Scene.GetRootAgentCount() == 0)
|
||||
{
|
||||
//If the region is empty, this change has been made by an automated process
|
||||
//and thus we delay the persist time by a random amount between 1.5 and 2.5.
|
||||
|
||||
float factor = 1.5f + (float)(m_rand.NextDouble());
|
||||
m_maxPersistTime = (long)((float)Scene.m_persistAfter * factor);
|
||||
m_minPersistTime = (long)((float)Scene.m_dontPersistBefore * factor);
|
||||
}
|
||||
else
|
||||
{
|
||||
//If the region is not empty, we want to obey the minimum and maximum persist times
|
||||
//but add a random factor so we stagger the object persistance a little
|
||||
m_maxPersistTime = (long)((float)Scene.m_persistAfter * (1.0d - (m_rand.NextDouble() / 5.0d))); //Multiply by 1.0-1.5
|
||||
m_minPersistTime = (long)((float)Scene.m_dontPersistBefore * (1.0d + (m_rand.NextDouble() / 2.0d))); //Multiply by 0.8-1.0
|
||||
}
|
||||
}
|
||||
m_hasGroupChanged = value;
|
||||
}
|
||||
|
@ -197,8 +223,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return false;
|
||||
if (m_scene.ShuttingDown)
|
||||
return true;
|
||||
|
||||
if (m_minPersistTime == 0 || m_maxPersistTime == 0)
|
||||
{
|
||||
m_maxPersistTime = m_scene.m_persistAfter;
|
||||
m_minPersistTime = m_scene.m_dontPersistBefore;
|
||||
}
|
||||
|
||||
long currentTime = DateTime.Now.Ticks;
|
||||
if (currentTime - timeLastChanged > m_scene.m_dontPersistBefore || currentTime - timeFirstChanged > m_scene.m_persistAfter)
|
||||
|
||||
if (timeLastChanged == 0) timeLastChanged = currentTime;
|
||||
if (timeFirstChanged == 0) timeFirstChanged = currentTime;
|
||||
|
||||
if (currentTime - timeLastChanged > m_minPersistTime || currentTime - timeFirstChanged > m_maxPersistTime)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -529,6 +566,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public SceneObjectGroup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -2203,13 +2241,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void ScheduleGroupForTerseUpdate()
|
||||
{
|
||||
<<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
|
||||
lockPartsForRead(true);
|
||||
=======
|
||||
// m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID);
|
||||
|
||||
lock (m_parts)
|
||||
>>>>>>> 0.6.9-post-fixes:OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
|
||||
{
|
||||
foreach (SceneObjectPart part in m_parts.Values)
|
||||
{
|
||||
|
@ -3765,15 +3797,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
HasGroupChanged = true;
|
||||
}
|
||||
<<<<<<< HEAD:OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
|
||||
lockPartsForRead(false);
|
||||
ScheduleGroupForFullUpdate();
|
||||
=======
|
||||
|
||||
// Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
|
||||
// for the same object with very different properties. The caller must schedule the update.
|
||||
//ScheduleGroupForFullUpdate();
|
||||
>>>>>>> 0.6.9-post-fixes:OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
|
||||
}
|
||||
|
||||
public void TriggerScriptChangedEvent(Changed val)
|
||||
|
|
|
@ -5266,7 +5266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public LSL_Integer llGetRegionAgentCount()
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
return new LSL_Integer(World.GetAvatars().Count);
|
||||
return new LSL_Integer(World.GetRootAgentCount());
|
||||
}
|
||||
|
||||
public LSL_Vector llGetRegionCorner()
|
||||
|
|
Loading…
Reference in New Issue