aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs30
1 files changed, 27 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c25ae10..8cd77f8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -220,7 +220,7 @@ namespace OpenSim.Region.Framework.Scenes
220 private bool m_scripts_enabled = true; 220 private bool m_scripts_enabled = true;
221 private string m_defaultScriptEngine; 221 private string m_defaultScriptEngine;
222 private int m_LastLogin = 0; 222 private int m_LastLogin = 0;
223 private Thread HeartbeatThread; 223 private Thread HeartbeatThread = null;
224 private volatile bool shuttingdown = false; 224 private volatile bool shuttingdown = false;
225 225
226 private int m_lastUpdate = Environment.TickCount; 226 private int m_lastUpdate = Environment.TickCount;
@@ -876,6 +876,13 @@ namespace OpenSim.Region.Framework.Scenes
876 //m_heartbeatTimer.Enabled = true; 876 //m_heartbeatTimer.Enabled = true;
877 //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); 877 //m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
878 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 878 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
879 if (HeartbeatThread != null)
880 {
881 ThreadTracker.Remove(HeartbeatThread);
882 HeartbeatThread.Abort();
883 HeartbeatThread = null;
884 }
885 m_lastUpdate = Environment.TickCount;
879 HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat)); 886 HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat));
880 HeartbeatThread.SetApartmentState(ApartmentState.MTA); 887 HeartbeatThread.SetApartmentState(ApartmentState.MTA);
881 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); 888 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
@@ -912,9 +919,15 @@ namespace OpenSim.Region.Framework.Scenes
912 /// <param name="e"></param> 919 /// <param name="e"></param>
913 private void Heartbeat(object sender) 920 private void Heartbeat(object sender)
914 { 921 {
915 Update(); 922 try
923 {
924 Update();
916 925
917 m_lastUpdate = Environment.TickCount; 926 m_lastUpdate = Environment.TickCount;
927 }
928 catch (ThreadAbortException)
929 {
930 }
918 } 931 }
919 932
920 /// <summary> 933 /// <summary>
@@ -2307,6 +2320,7 @@ namespace OpenSim.Region.Framework.Scenes
2307 /// <param name="client"></param> 2320 /// <param name="client"></param>
2308 public override void AddNewClient(IClientAPI client) 2321 public override void AddNewClient(IClientAPI client)
2309 { 2322 {
2323 CheckHeartbeat();
2310 SubscribeToClientEvents(client); 2324 SubscribeToClientEvents(client);
2311 ScenePresence presence; 2325 ScenePresence presence;
2312 2326
@@ -2831,6 +2845,7 @@ namespace OpenSim.Region.Framework.Scenes
2831 /// <returns></returns> 2845 /// <returns></returns>
2832 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) 2846 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
2833 { 2847 {
2848 CheckHeartbeat();
2834 AvatarAppearance appearance = null; 2849 AvatarAppearance appearance = null;
2835 GetAvatarAppearance(client, out appearance); 2850 GetAvatarAppearance(client, out appearance);
2836 2851
@@ -2873,6 +2888,7 @@ namespace OpenSim.Region.Framework.Scenes
2873 /// <param name="agentID"></param> 2888 /// <param name="agentID"></param>
2874 public override void RemoveClient(UUID agentID) 2889 public override void RemoveClient(UUID agentID)
2875 { 2890 {
2891 CheckHeartbeat();
2876 bool childagentYN = false; 2892 bool childagentYN = false;
2877 ScenePresence avatar = GetScenePresence(agentID); 2893 ScenePresence avatar = GetScenePresence(agentID);
2878 if (avatar != null) 2894 if (avatar != null)
@@ -4374,6 +4390,8 @@ namespace OpenSim.Region.Framework.Scenes
4374 else 4390 else
4375 return health; 4391 return health;
4376 4392
4393 CheckHeartbeat();
4394
4377 return health; 4395 return health;
4378 } 4396 }
4379 4397
@@ -4559,5 +4577,11 @@ namespace OpenSim.Region.Framework.Scenes
4559 4577
4560 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; 4578 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
4561 } 4579 }
4580
4581 private void CheckHeartbeat()
4582 {
4583 if (System.Environment.TickCount - m_lastUpdate > 2000)
4584 StartTimer();
4585 }
4562 } 4586 }
4563} 4587}