mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Application/OpenSimBase.cs OpenSim/Region/Framework/Scenes/Scene.cs
This commit is contained in:
@@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
|
||||
// XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
|
||||
// are referenced with lower case names!
|
||||
UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name);
|
||||
UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper());
|
||||
if (animID == UUID.Zero)
|
||||
return;
|
||||
|
||||
|
||||
@@ -215,14 +215,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
private bool m_cleaningTemps = false;
|
||||
|
||||
private Object m_heartbeatLock = new Object();
|
||||
// private Object m_heartbeatLock = new Object();
|
||||
|
||||
// TODO: Possibly stop other classes being able to manipulate this directly.
|
||||
private SceneGraph m_sceneGraph;
|
||||
private volatile int m_bordersLocked;
|
||||
// private int m_RestartTimerCounter;
|
||||
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
|
||||
// private int m_incrementsof15seconds;
|
||||
private volatile bool m_backingup;
|
||||
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
|
||||
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
|
||||
@@ -230,16 +228,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private bool m_physics_enabled = true;
|
||||
private bool m_scripts_enabled = true;
|
||||
private string m_defaultScriptEngine;
|
||||
private int m_LastLogin;
|
||||
private Thread HeartbeatThread = null;
|
||||
private volatile bool shuttingdown;
|
||||
|
||||
private int m_lastUpdate;
|
||||
/// <summary>
|
||||
/// Tick at which the last login occurred.
|
||||
/// </summary>
|
||||
private int m_LastLogin;
|
||||
|
||||
private int m_lastIncoming;
|
||||
private int m_lastOutgoing;
|
||||
private bool m_firstHeartbeat = true;
|
||||
private int m_hbRestarts = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Thread that runs the scene loop.
|
||||
/// </summary>
|
||||
private Thread m_heartbeatThread;
|
||||
|
||||
/// <summary>
|
||||
/// True if these scene is in the process of shutting down or is shutdown.
|
||||
/// </summary>
|
||||
public bool ShuttingDown
|
||||
{
|
||||
get { return m_shuttingDown; }
|
||||
}
|
||||
private volatile bool m_shuttingDown;
|
||||
|
||||
// private int m_lastUpdate;
|
||||
private bool m_firstHeartbeat = true;
|
||||
|
||||
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
|
||||
private bool m_reprioritizationEnabled = true;
|
||||
private double m_reprioritizationInterval = 5000.0;
|
||||
@@ -577,7 +593,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_EstateDataService = estateDataService;
|
||||
m_regionHandle = m_regInfo.RegionHandle;
|
||||
m_regionName = m_regInfo.RegionName;
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
m_lastIncoming = 0;
|
||||
m_lastOutgoing = 0;
|
||||
|
||||
@@ -834,18 +849,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
m_permissions = new ScenePermissions(this);
|
||||
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Startup / Close Methods
|
||||
|
||||
public bool ShuttingDown
|
||||
{
|
||||
get { return shuttingdown; }
|
||||
}
|
||||
|
||||
/// <value>
|
||||
/// The scene graph for this scene
|
||||
/// </value>
|
||||
@@ -1107,6 +1117,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_physics_enabled = enablePhysics;
|
||||
}
|
||||
|
||||
// if (options.ContainsKey("collisions"))
|
||||
// {
|
||||
// // TODO: Implement. If false, should stop objects colliding, though possibly should still allow
|
||||
// // the avatar themselves to collide with the ground.
|
||||
// }
|
||||
|
||||
if (options.ContainsKey("teleport"))
|
||||
{
|
||||
bool enableTeleportDebugging;
|
||||
@@ -1158,8 +1174,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
|
||||
|
||||
// Stop updating the scene objects and agents.
|
||||
//m_heartbeatTimer.Close();
|
||||
shuttingdown = true;
|
||||
m_shuttingDown = true;
|
||||
|
||||
m_log.Debug("[SCENE]: Persisting changed objects");
|
||||
EventManager.TriggerSceneShuttingDown(this);
|
||||
@@ -1183,16 +1198,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the timer which triggers regular scene updates
|
||||
/// Start the scene
|
||||
/// </summary>
|
||||
public void StartTimer()
|
||||
public void Start()
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName);
|
||||
|
||||
//m_heartbeatTimer.Enabled = true;
|
||||
//m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
|
||||
//m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
|
||||
if (HeartbeatThread != null)
|
||||
if (m_heartbeatThread != null)
|
||||
{
|
||||
m_hbRestarts++;
|
||||
if(m_hbRestarts > 10)
|
||||
@@ -1208,13 +1223,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//proc.WaitForExit();
|
||||
//Thread.Sleep(1000);
|
||||
//Environment.Exit(1);
|
||||
HeartbeatThread.Abort();
|
||||
Watchdog.AbortThread(HeartbeatThread.ManagedThreadId);
|
||||
HeartbeatThread = null;
|
||||
m_heartbeatThread.Abort();
|
||||
Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId);
|
||||
m_heartbeatThread = null;
|
||||
}
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
||||
|
||||
HeartbeatThread
|
||||
m_heartbeatThread
|
||||
= Watchdog.StartThread(
|
||||
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
|
||||
}
|
||||
@@ -1245,30 +1260,32 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
private void Heartbeat()
|
||||
{
|
||||
if (!Monitor.TryEnter(m_heartbeatLock))
|
||||
{
|
||||
Watchdog.RemoveThread();
|
||||
return;
|
||||
}
|
||||
// if (!Monitor.TryEnter(m_heartbeatLock))
|
||||
// {
|
||||
// Watchdog.RemoveThread();
|
||||
// return;
|
||||
// }
|
||||
|
||||
try
|
||||
{
|
||||
m_eventManager.TriggerOnRegionStarted(this);
|
||||
// try
|
||||
// {
|
||||
|
||||
// The first frame can take a very long time due to physics actors being added on startup. Therefore,
|
||||
// don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
|
||||
// alarms for scenes with many objects.
|
||||
Update(1);
|
||||
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
|
||||
m_eventManager.TriggerOnRegionStarted(this);
|
||||
|
||||
while (!shuttingdown)
|
||||
Update(-1);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Monitor.Pulse(m_heartbeatLock);
|
||||
Monitor.Exit(m_heartbeatLock);
|
||||
}
|
||||
// The first frame can take a very long time due to physics actors being added on startup. Therefore,
|
||||
// don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
|
||||
// alarms for scenes with many objects.
|
||||
Update(1);
|
||||
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
|
||||
Update(-1);
|
||||
|
||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
||||
// m_firstHeartbeat = false;
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// Monitor.Pulse(m_heartbeatLock);
|
||||
// Monitor.Exit(m_heartbeatLock);
|
||||
// }
|
||||
|
||||
Watchdog.RemoveThread();
|
||||
}
|
||||
@@ -1287,7 +1304,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
List<Vector3> coarseLocations;
|
||||
List<UUID> avatarUUIDs;
|
||||
|
||||
while (!shuttingdown && (endFrame == null || Frame < endFrame))
|
||||
while (!m_shuttingDown && (endFrame == null || Frame < endFrame))
|
||||
{
|
||||
maintc = Util.EnvironmentTickCount();
|
||||
++Frame;
|
||||
@@ -1463,15 +1480,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
|
||||
maintc = (int)(MinFrameTime * 1000) - maintc;
|
||||
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
m_firstHeartbeat = false;
|
||||
|
||||
if (maintc > 0)
|
||||
Thread.Sleep(maintc);
|
||||
|
||||
m_lastUpdate = Util.EnvironmentTickCount();
|
||||
m_firstHeartbeat = false;
|
||||
|
||||
// Optionally warn if a frame takes double the amount of time that it should.
|
||||
if (DebugUpdates
|
||||
&& Util.EnvironmentTickCountSubtract(
|
||||
@@ -2662,7 +2675,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|| (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
|
||||
|
||||
CheckHeartbeat();
|
||||
ScenePresence presence;
|
||||
|
||||
ScenePresence sp = GetScenePresence(client.AgentId);
|
||||
|
||||
@@ -3253,7 +3265,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public override void RemoveClient(UUID agentID, bool closeChildAgents)
|
||||
{
|
||||
CheckHeartbeat();
|
||||
// CheckHeartbeat();
|
||||
bool isChildAgent = false;
|
||||
ScenePresence avatar = GetScenePresence(agentID);
|
||||
if (avatar != null)
|
||||
@@ -4700,7 +4712,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
int health=1; // Start at 1, means we're up
|
||||
|
||||
if (Util.EnvironmentTickCountSubtract(m_lastUpdate) < 1000)
|
||||
if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
|
||||
{
|
||||
health+=1;
|
||||
flags |= 1;
|
||||
@@ -4737,6 +4749,8 @@ Environment.Exit(1);
|
||||
//
|
||||
if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000)
|
||||
health++;
|
||||
else
|
||||
return health;
|
||||
|
||||
return health;
|
||||
}
|
||||
@@ -4929,8 +4943,8 @@ Environment.Exit(1);
|
||||
if (m_firstHeartbeat)
|
||||
return;
|
||||
|
||||
if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 5000)
|
||||
StartTimer();
|
||||
if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000)
|
||||
Start();
|
||||
}
|
||||
|
||||
public override ISceneObject DeserializeObject(string representation)
|
||||
|
||||
Reference in New Issue
Block a user