Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Application/OpenSimBase.cs
	OpenSim/Region/Framework/Scenes/Scene.cs
avinationmerge
Melanie 2012-03-23 02:44:22 +00:00
commit 2190a62366
6 changed files with 96 additions and 86 deletions

View File

@ -508,8 +508,7 @@ namespace OpenSim
scene.SnmpService.LinkUp(scene); scene.SnmpService.LinkUp(scene);
} }
scene.StartTimer(); scene.Start();
scene.StartTimerWatchdog();
scene.StartScripts(); scene.StartScripts();

View File

@ -598,12 +598,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
"[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
} }
else // else
{ // {
m_log.ErrorFormat( // m_log.ErrorFormat(
"[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}", // "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}",
m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY); // m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY);
} // }
} }
/// <summary> /// <summary>

View File

@ -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 // 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! // are referenced with lower case names!
UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name); UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper());
if (animID == UUID.Zero) if (animID == UUID.Zero)
return; return;

View File

@ -215,14 +215,12 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
private bool m_cleaningTemps = false; 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. // TODO: Possibly stop other classes being able to manipulate this directly.
private SceneGraph m_sceneGraph; private SceneGraph m_sceneGraph;
private volatile int m_bordersLocked; private volatile int m_bordersLocked;
// private int m_RestartTimerCounter;
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
// private int m_incrementsof15seconds;
private volatile bool m_backingup; private volatile bool m_backingup;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); 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_physics_enabled = true;
private bool m_scripts_enabled = true; private bool m_scripts_enabled = true;
private string m_defaultScriptEngine; 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_lastIncoming;
private int m_lastOutgoing; private int m_lastOutgoing;
private bool m_firstHeartbeat = true;
private int m_hbRestarts = 0; 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 UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
private bool m_reprioritizationEnabled = true; private bool m_reprioritizationEnabled = true;
private double m_reprioritizationInterval = 5000.0; private double m_reprioritizationInterval = 5000.0;
@ -577,7 +593,6 @@ namespace OpenSim.Region.Framework.Scenes
m_EstateDataService = estateDataService; m_EstateDataService = estateDataService;
m_regionHandle = m_regInfo.RegionHandle; m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName; m_regionName = m_regInfo.RegionName;
m_lastUpdate = Util.EnvironmentTickCount();
m_lastIncoming = 0; m_lastIncoming = 0;
m_lastOutgoing = 0; m_lastOutgoing = 0;
@ -834,18 +849,13 @@ namespace OpenSim.Region.Framework.Scenes
m_permissions = new ScenePermissions(this); m_permissions = new ScenePermissions(this);
m_lastUpdate = Util.EnvironmentTickCount(); // m_lastUpdate = Util.EnvironmentTickCount();
} }
#endregion #endregion
#region Startup / Close Methods #region Startup / Close Methods
public bool ShuttingDown
{
get { return shuttingdown; }
}
/// <value> /// <value>
/// The scene graph for this scene /// The scene graph for this scene
/// </value> /// </value>
@ -1107,6 +1117,12 @@ namespace OpenSim.Region.Framework.Scenes
m_physics_enabled = enablePhysics; 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")) if (options.ContainsKey("teleport"))
{ {
bool enableTeleportDebugging; bool enableTeleportDebugging;
@ -1158,8 +1174,7 @@ namespace OpenSim.Region.Framework.Scenes
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
// Stop updating the scene objects and agents. // Stop updating the scene objects and agents.
//m_heartbeatTimer.Close(); m_shuttingDown = true;
shuttingdown = true;
m_log.Debug("[SCENE]: Persisting changed objects"); m_log.Debug("[SCENE]: Persisting changed objects");
EventManager.TriggerSceneShuttingDown(this); EventManager.TriggerSceneShuttingDown(this);
@ -1183,16 +1198,16 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// Start the timer which triggers regular scene updates /// Start the scene
/// </summary> /// </summary>
public void StartTimer() public void Start()
{ {
// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName);
//m_heartbeatTimer.Enabled = true; //m_heartbeatTimer.Enabled = true;
//m_heartbeatTimer.Interval = (int)(m_timespan * 1000); //m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
//m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
if (HeartbeatThread != null) if (m_heartbeatThread != null)
{ {
m_hbRestarts++; m_hbRestarts++;
if(m_hbRestarts > 10) if(m_hbRestarts > 10)
@ -1208,13 +1223,13 @@ namespace OpenSim.Region.Framework.Scenes
//proc.WaitForExit(); //proc.WaitForExit();
//Thread.Sleep(1000); //Thread.Sleep(1000);
//Environment.Exit(1); //Environment.Exit(1);
HeartbeatThread.Abort(); m_heartbeatThread.Abort();
Watchdog.AbortThread(HeartbeatThread.ManagedThreadId); Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId);
HeartbeatThread = null; m_heartbeatThread = null;
} }
m_lastUpdate = Util.EnvironmentTickCount(); // m_lastUpdate = Util.EnvironmentTickCount();
HeartbeatThread m_heartbeatThread
= Watchdog.StartThread( = Watchdog.StartThread(
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
} }
@ -1245,30 +1260,32 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
private void Heartbeat() private void Heartbeat()
{ {
if (!Monitor.TryEnter(m_heartbeatLock)) // if (!Monitor.TryEnter(m_heartbeatLock))
{ // {
Watchdog.RemoveThread(); // Watchdog.RemoveThread();
return; // return;
} // }
try // try
{ // {
m_eventManager.TriggerOnRegionStarted(this);
// The first frame can take a very long time due to physics actors being added on startup. Therefore, m_eventManager.TriggerOnRegionStarted(this);
// 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;
while (!shuttingdown) // The first frame can take a very long time due to physics actors being added on startup. Therefore,
Update(-1); // 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.
finally Update(1);
{ Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
Monitor.Pulse(m_heartbeatLock); Update(-1);
Monitor.Exit(m_heartbeatLock);
} // m_lastUpdate = Util.EnvironmentTickCount();
// m_firstHeartbeat = false;
// }
// finally
// {
// Monitor.Pulse(m_heartbeatLock);
// Monitor.Exit(m_heartbeatLock);
// }
Watchdog.RemoveThread(); Watchdog.RemoveThread();
} }
@ -1287,7 +1304,7 @@ namespace OpenSim.Region.Framework.Scenes
List<Vector3> coarseLocations; List<Vector3> coarseLocations;
List<UUID> avatarUUIDs; List<UUID> avatarUUIDs;
while (!shuttingdown && (endFrame == null || Frame < endFrame)) while (!m_shuttingDown && (endFrame == null || Frame < endFrame))
{ {
maintc = Util.EnvironmentTickCount(); maintc = Util.EnvironmentTickCount();
++Frame; ++Frame;
@ -1463,15 +1480,11 @@ namespace OpenSim.Region.Framework.Scenes
maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
maintc = (int)(MinFrameTime * 1000) - maintc; maintc = (int)(MinFrameTime * 1000) - maintc;
m_lastUpdate = Util.EnvironmentTickCount();
m_firstHeartbeat = false; m_firstHeartbeat = false;
if (maintc > 0) if (maintc > 0)
Thread.Sleep(maintc); Thread.Sleep(maintc);
m_lastUpdate = Util.EnvironmentTickCount();
m_firstHeartbeat = false;
// Optionally warn if a frame takes double the amount of time that it should. // Optionally warn if a frame takes double the amount of time that it should.
if (DebugUpdates if (DebugUpdates
&& Util.EnvironmentTickCountSubtract( && Util.EnvironmentTickCountSubtract(
@ -2662,7 +2675,6 @@ namespace OpenSim.Region.Framework.Scenes
|| (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
CheckHeartbeat(); CheckHeartbeat();
ScenePresence presence;
ScenePresence sp = GetScenePresence(client.AgentId); ScenePresence sp = GetScenePresence(client.AgentId);
@ -3253,7 +3265,7 @@ namespace OpenSim.Region.Framework.Scenes
public override void RemoveClient(UUID agentID, bool closeChildAgents) public override void RemoveClient(UUID agentID, bool closeChildAgents)
{ {
CheckHeartbeat(); // CheckHeartbeat();
bool isChildAgent = false; bool isChildAgent = false;
ScenePresence avatar = GetScenePresence(agentID); ScenePresence avatar = GetScenePresence(agentID);
if (avatar != null) if (avatar != null)
@ -4700,7 +4712,7 @@ namespace OpenSim.Region.Framework.Scenes
int health=1; // Start at 1, means we're up int health=1; // Start at 1, means we're up
if (Util.EnvironmentTickCountSubtract(m_lastUpdate) < 1000) if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
{ {
health+=1; health+=1;
flags |= 1; flags |= 1;
@ -4737,6 +4749,8 @@ Environment.Exit(1);
// //
if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000)
health++; health++;
else
return health;
return health; return health;
} }
@ -4929,8 +4943,8 @@ Environment.Exit(1);
if (m_firstHeartbeat) if (m_firstHeartbeat)
return; return;
if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 5000) if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000)
StartTimer(); Start();
} }
public override ISceneObject DeserializeObject(string representation) public override ISceneObject DeserializeObject(string representation)

View File

@ -70,8 +70,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
public void Initialise(IConfigSource config) public void Initialise(IConfigSource config)
{ {
//m_log.Info("[RegionReady] Initialising");
m_config = config.Configs["RegionReady"]; m_config = config.Configs["RegionReady"];
if (m_config != null) if (m_config != null)
{ {
@ -84,9 +82,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
m_uri = m_config.GetString("alert_uri",string.Empty); m_uri = m_config.GetString("alert_uri",string.Empty);
} }
} }
// if (!m_enabled)
// m_log.Info("[RegionReady] disabled.");
} }
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
@ -113,7 +108,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
{ {
scene.LoginLock = true; scene.LoginLock = true;
scene.LoginsDisabled = true; scene.LoginsDisabled = true;
m_log.InfoFormat("[RegionReady]: Logins disabled for {0}",m_scene.RegionInfo.RegionName); m_log.InfoFormat("[RegionReady]: Region {0} - logins disabled during initialization.",m_scene.RegionInfo.RegionName);
if(m_uri != string.Empty) if(m_uri != string.Empty)
{ {
@ -167,7 +162,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
void OnEmptyScriptCompileQueue(int numScriptsFailed, string message) void OnEmptyScriptCompileQueue(int numScriptsFailed, string message)
{ {
m_log.InfoFormat("[RegionReady]: Script compile queue empty!"); m_log.DebugFormat("[RegionReady]: Script compile queue empty!");
if (m_firstEmptyCompileQueue || m_oarFileLoading) if (m_firstEmptyCompileQueue || m_oarFileLoading)
{ {
@ -194,7 +189,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
c.SenderUUID = UUID.Zero; c.SenderUUID = UUID.Zero;
c.Scene = m_scene; c.Scene = m_scene;
m_log.InfoFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}", m_log.DebugFormat("[RegionReady]: Region \"{0}\" is ready: \"{1}\" on channel {2}",
m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); m_scene.RegionInfo.RegionName, c.Message, m_channelNotify);
m_scene.EventManager.TriggerOnChatBroadcast(this, c); m_scene.EventManager.TriggerOnChatBroadcast(this, c);
@ -210,7 +205,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
{ {
m_lastOarLoadedOk = true; m_lastOarLoadedOk = true;
} else { } else {
m_log.InfoFormat("[RegionReady]: Oar file load errors: {0}", message); m_log.WarnFormat("[RegionReady]: Oar file load errors: {0}", message);
m_lastOarLoadedOk = false; m_lastOarLoadedOk = false;
} }
} }
@ -233,7 +228,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
// m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
// m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
m_log.InfoFormat("[RegionReady]: Logins enabled for {0}", m_scene.RegionInfo.RegionName); m_log.InfoFormat("[RegionReady]: Initialization complete - logins enabled for {0}", m_scene.RegionInfo.RegionName);
if ( m_uri != string.Empty ) if ( m_uri != string.Empty )
{ {

View File

@ -73,17 +73,19 @@ namespace OpenSim.Server.Handlers.Login
if (requestData != null) if (requestData != null)
{ {
foreach (string key in requestData.Keys) // Debug code to show exactly what login parameters the viewer is sending us.
{ // TODO: Extract into a method that can be generally applied if one doesn't already exist.
object value = requestData[key]; // foreach (string key in requestData.Keys)
Console.WriteLine("{0}:{1}", key, value); // {
if (value is ArrayList) // object value = requestData[key];
{ // Console.WriteLine("{0}:{1}", key, value);
ICollection col = value as ICollection; // if (value is ArrayList)
foreach (object item in col) // {
Console.WriteLine(" {0}", item); // ICollection col = value as ICollection;
} // foreach (object item in col)
} // Console.WriteLine(" {0}", item);
// }
// }
if (requestData.ContainsKey("first") && requestData["first"] != null && if (requestData.ContainsKey("first") && requestData["first"] != null &&
requestData.ContainsKey("last") && requestData["last"] != null && ( requestData.ContainsKey("last") && requestData["last"] != null && (