aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs35
1 files changed, 32 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 278091f..3b91dd0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -220,11 +220,12 @@ 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;
227 private int m_maxPrimsPerFrame = 200; 227 private int m_maxPrimsPerFrame = 200;
228 private bool m_firstHeartbeat = true;
228 229
229 private object m_deleting_scene_object = new object(); 230 private object m_deleting_scene_object = new object();
230 231
@@ -876,6 +877,13 @@ namespace OpenSim.Region.Framework.Scenes
876 //m_heartbeatTimer.Enabled = true; 877 //m_heartbeatTimer.Enabled = true;
877 //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); 878 //m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
878 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 879 //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
880 if (HeartbeatThread != null)
881 {
882 ThreadTracker.Remove(HeartbeatThread);
883 HeartbeatThread.Abort();
884 HeartbeatThread = null;
885 }
886 m_lastUpdate = Environment.TickCount;
879 HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat)); 887 HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat));
880 HeartbeatThread.SetApartmentState(ApartmentState.MTA); 888 HeartbeatThread.SetApartmentState(ApartmentState.MTA);
881 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); 889 HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
@@ -912,9 +920,16 @@ namespace OpenSim.Region.Framework.Scenes
912 /// <param name="e"></param> 920 /// <param name="e"></param>
913 private void Heartbeat(object sender) 921 private void Heartbeat(object sender)
914 { 922 {
915 Update(); 923 try
924 {
925 Update();
916 926
917 m_lastUpdate = Environment.TickCount; 927 m_lastUpdate = Environment.TickCount;
928 m_firstHeartbeat = false;
929 }
930 catch (ThreadAbortException)
931 {
932 }
918 } 933 }
919 934
920 /// <summary> 935 /// <summary>
@@ -2307,6 +2322,7 @@ namespace OpenSim.Region.Framework.Scenes
2307 /// <param name="client"></param> 2322 /// <param name="client"></param>
2308 public override void AddNewClient(IClientAPI client) 2323 public override void AddNewClient(IClientAPI client)
2309 { 2324 {
2325 CheckHeartbeat();
2310 SubscribeToClientEvents(client); 2326 SubscribeToClientEvents(client);
2311 ScenePresence presence; 2327 ScenePresence presence;
2312 2328
@@ -2831,6 +2847,7 @@ namespace OpenSim.Region.Framework.Scenes
2831 /// <returns></returns> 2847 /// <returns></returns>
2832 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) 2848 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
2833 { 2849 {
2850 CheckHeartbeat();
2834 AvatarAppearance appearance = null; 2851 AvatarAppearance appearance = null;
2835 GetAvatarAppearance(client, out appearance); 2852 GetAvatarAppearance(client, out appearance);
2836 2853
@@ -2873,6 +2890,7 @@ namespace OpenSim.Region.Framework.Scenes
2873 /// <param name="agentID"></param> 2890 /// <param name="agentID"></param>
2874 public override void RemoveClient(UUID agentID) 2891 public override void RemoveClient(UUID agentID)
2875 { 2892 {
2893 CheckHeartbeat();
2876 bool childagentYN = false; 2894 bool childagentYN = false;
2877 ScenePresence avatar = GetScenePresence(agentID); 2895 ScenePresence avatar = GetScenePresence(agentID);
2878 if (avatar != null) 2896 if (avatar != null)
@@ -4380,6 +4398,8 @@ namespace OpenSim.Region.Framework.Scenes
4380 else 4398 else
4381 return health; 4399 return health;
4382 4400
4401 CheckHeartbeat();
4402
4383 return health; 4403 return health;
4384 } 4404 }
4385 4405
@@ -4565,5 +4585,14 @@ namespace OpenSim.Region.Framework.Scenes
4565 4585
4566 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; 4586 return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
4567 } 4587 }
4588
4589 private void CheckHeartbeat()
4590 {
4591 if (m_firstHeartbeat)
4592 return;
4593
4594 if (System.Environment.TickCount - m_lastUpdate > 2000)
4595 StartTimer();
4596 }
4568 } 4597 }
4569} 4598}