diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 100 |
1 files changed, 55 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 76e632e..d354ef0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -211,14 +211,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
211 | /// </summary> | 211 | /// </summary> |
212 | private bool m_cleaningTemps = false; | 212 | private bool m_cleaningTemps = false; |
213 | 213 | ||
214 | private Object m_heartbeatLock = new Object(); | 214 | // private Object m_heartbeatLock = new Object(); |
215 | 215 | ||
216 | // TODO: Possibly stop other classes being able to manipulate this directly. | 216 | // TODO: Possibly stop other classes being able to manipulate this directly. |
217 | private SceneGraph m_sceneGraph; | 217 | private SceneGraph m_sceneGraph; |
218 | private volatile int m_bordersLocked; | 218 | private volatile int m_bordersLocked; |
219 | // private int m_RestartTimerCounter; | ||
220 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing | 219 | private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing |
221 | // private int m_incrementsof15seconds; | ||
222 | private volatile bool m_backingup; | 220 | private volatile bool m_backingup; |
223 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); | 221 | private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); |
224 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); | 222 | private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); |
@@ -226,12 +224,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | private bool m_physics_enabled = true; | 224 | private bool m_physics_enabled = true; |
227 | private bool m_scripts_enabled = true; | 225 | private bool m_scripts_enabled = true; |
228 | private string m_defaultScriptEngine; | 226 | private string m_defaultScriptEngine; |
227 | |||
228 | /// <summary> | ||
229 | /// Tick at which the last login occurred. | ||
230 | /// </summary> | ||
229 | private int m_LastLogin; | 231 | private int m_LastLogin; |
232 | |||
230 | private Thread HeartbeatThread; | 233 | private Thread HeartbeatThread; |
231 | private volatile bool shuttingdown; | 234 | private volatile bool shuttingdown; |
232 | 235 | ||
233 | private int m_lastUpdate; | 236 | // private int m_lastUpdate; |
234 | private bool m_firstHeartbeat = true; | 237 | // private bool m_firstHeartbeat = true; |
235 | 238 | ||
236 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 239 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
237 | private bool m_reprioritizationEnabled = true; | 240 | private bool m_reprioritizationEnabled = true; |
@@ -801,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
801 | 804 | ||
802 | m_permissions = new ScenePermissions(this); | 805 | m_permissions = new ScenePermissions(this); |
803 | 806 | ||
804 | m_lastUpdate = Util.EnvironmentTickCount(); | 807 | // m_lastUpdate = Util.EnvironmentTickCount(); |
805 | } | 808 | } |
806 | 809 | ||
807 | #endregion | 810 | #endregion |
@@ -1074,6 +1077,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1074 | m_physics_enabled = enablePhysics; | 1077 | m_physics_enabled = enablePhysics; |
1075 | } | 1078 | } |
1076 | 1079 | ||
1080 | // if (options.ContainsKey("collisions")) | ||
1081 | // { | ||
1082 | // // TODO: Implement. If false, should stop objects colliding, though possibly should still allow | ||
1083 | // // the avatar themselves to collide with the ground. | ||
1084 | // } | ||
1085 | |||
1077 | if (options.ContainsKey("teleport")) | 1086 | if (options.ContainsKey("teleport")) |
1078 | { | 1087 | { |
1079 | bool enableTeleportDebugging; | 1088 | bool enableTeleportDebugging; |
@@ -1150,9 +1159,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1150 | } | 1159 | } |
1151 | 1160 | ||
1152 | /// <summary> | 1161 | /// <summary> |
1153 | /// Start the timer which triggers regular scene updates | 1162 | /// Start the scene |
1154 | /// </summary> | 1163 | /// </summary> |
1155 | public void StartTimer() | 1164 | public void Start() |
1156 | { | 1165 | { |
1157 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); | 1166 | // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); |
1158 | 1167 | ||
@@ -1164,7 +1173,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1164 | HeartbeatThread.Abort(); | 1173 | HeartbeatThread.Abort(); |
1165 | HeartbeatThread = null; | 1174 | HeartbeatThread = null; |
1166 | } | 1175 | } |
1167 | m_lastUpdate = Util.EnvironmentTickCount(); | 1176 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1168 | 1177 | ||
1169 | HeartbeatThread | 1178 | HeartbeatThread |
1170 | = Watchdog.StartThread( | 1179 | = Watchdog.StartThread( |
@@ -1197,33 +1206,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
1197 | /// </summary> | 1206 | /// </summary> |
1198 | private void Heartbeat() | 1207 | private void Heartbeat() |
1199 | { | 1208 | { |
1200 | if (!Monitor.TryEnter(m_heartbeatLock)) | 1209 | // if (!Monitor.TryEnter(m_heartbeatLock)) |
1201 | { | 1210 | // { |
1202 | Watchdog.RemoveThread(); | 1211 | // Watchdog.RemoveThread(); |
1203 | return; | 1212 | // return; |
1204 | } | 1213 | // } |
1205 | 1214 | ||
1206 | try | 1215 | // try |
1207 | { | 1216 | // { |
1208 | m_eventManager.TriggerOnRegionStarted(this); | ||
1209 | 1217 | ||
1210 | // The first frame can take a very long time due to physics actors being added on startup. Therefore, | 1218 | m_eventManager.TriggerOnRegionStarted(this); |
1211 | // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false | ||
1212 | // alarms for scenes with many objects. | ||
1213 | Update(1); | ||
1214 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; | ||
1215 | 1219 | ||
1216 | while (!shuttingdown) | 1220 | // The first frame can take a very long time due to physics actors being added on startup. Therefore, |
1217 | Update(-1); | 1221 | // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false |
1222 | // alarms for scenes with many objects. | ||
1223 | Update(1); | ||
1224 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; | ||
1218 | 1225 | ||
1219 | m_lastUpdate = Util.EnvironmentTickCount(); | 1226 | while (!shuttingdown) |
1220 | m_firstHeartbeat = false; | 1227 | Update(-1); |
1221 | } | 1228 | |
1222 | finally | 1229 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1223 | { | 1230 | // m_firstHeartbeat = false; |
1224 | Monitor.Pulse(m_heartbeatLock); | 1231 | // } |
1225 | Monitor.Exit(m_heartbeatLock); | 1232 | // finally |
1226 | } | 1233 | // { |
1234 | // Monitor.Pulse(m_heartbeatLock); | ||
1235 | // Monitor.Exit(m_heartbeatLock); | ||
1236 | // } | ||
1227 | 1237 | ||
1228 | Watchdog.RemoveThread(); | 1238 | Watchdog.RemoveThread(); |
1229 | } | 1239 | } |
@@ -2535,7 +2545,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2535 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2545 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2536 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2546 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2537 | 2547 | ||
2538 | CheckHeartbeat(); | 2548 | // CheckHeartbeat(); |
2539 | 2549 | ||
2540 | ScenePresence sp = GetScenePresence(client.AgentId); | 2550 | ScenePresence sp = GetScenePresence(client.AgentId); |
2541 | 2551 | ||
@@ -3111,7 +3121,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3111 | 3121 | ||
3112 | public override void RemoveClient(UUID agentID, bool closeChildAgents) | 3122 | public override void RemoveClient(UUID agentID, bool closeChildAgents) |
3113 | { | 3123 | { |
3114 | CheckHeartbeat(); | 3124 | // CheckHeartbeat(); |
3115 | bool isChildAgent = false; | 3125 | bool isChildAgent = false; |
3116 | ScenePresence avatar = GetScenePresence(agentID); | 3126 | ScenePresence avatar = GetScenePresence(agentID); |
3117 | if (avatar != null) | 3127 | if (avatar != null) |
@@ -4498,8 +4508,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4498 | // | 4508 | // |
4499 | int health=1; // Start at 1, means we're up | 4509 | int health=1; // Start at 1, means we're up |
4500 | 4510 | ||
4501 | if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000) | 4511 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4502 | health+=1; | 4512 | health += 1; |
4503 | else | 4513 | else |
4504 | return health; | 4514 | return health; |
4505 | 4515 | ||
@@ -4510,7 +4520,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4510 | else | 4520 | else |
4511 | return health; | 4521 | return health; |
4512 | 4522 | ||
4513 | CheckHeartbeat(); | 4523 | // CheckHeartbeat(); |
4514 | 4524 | ||
4515 | return health; | 4525 | return health; |
4516 | } | 4526 | } |
@@ -4698,14 +4708,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4698 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 4708 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
4699 | } | 4709 | } |
4700 | 4710 | ||
4701 | private void CheckHeartbeat() | 4711 | // private void CheckHeartbeat() |
4702 | { | 4712 | // { |
4703 | if (m_firstHeartbeat) | 4713 | // if (m_firstHeartbeat) |
4704 | return; | 4714 | // return; |
4705 | 4715 | // | |
4706 | if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000) | 4716 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) |
4707 | StartTimer(); | 4717 | // StartTimer(); |
4708 | } | 4718 | // } |
4709 | 4719 | ||
4710 | public override ISceneObject DeserializeObject(string representation) | 4720 | public override ISceneObject DeserializeObject(string representation) |
4711 | { | 4721 | { |