From dcebbc3f1b27cf01ae28cb522c5180c195729823 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 6 Sep 2009 15:55:14 +0100
Subject: Remove the encryption from the IAuthenticationService interface. That
is too high up for that type of stuff. It needs to be at the
connector/handler level
---
OpenSim/Region/Framework/Scenes/Scene.cs | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework')
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
private bool m_scripts_enabled = true;
private string m_defaultScriptEngine;
private int m_LastLogin = 0;
- private Thread HeartbeatThread;
+ private Thread HeartbeatThread = null;
private volatile bool shuttingdown = false;
private int m_lastUpdate = Environment.TickCount;
@@ -876,6 +876,13 @@ namespace OpenSim.Region.Framework.Scenes
//m_heartbeatTimer.Enabled = true;
//m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
//m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
+ if (HeartbeatThread != null)
+ {
+ ThreadTracker.Remove(HeartbeatThread);
+ HeartbeatThread.Abort();
+ HeartbeatThread = null;
+ }
+ m_lastUpdate = Environment.TickCount;
HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat));
HeartbeatThread.SetApartmentState(ApartmentState.MTA);
HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName);
@@ -912,9 +919,15 @@ namespace OpenSim.Region.Framework.Scenes
///
private void Heartbeat(object sender)
{
- Update();
+ try
+ {
+ Update();
- m_lastUpdate = Environment.TickCount;
+ m_lastUpdate = Environment.TickCount;
+ }
+ catch (ThreadAbortException)
+ {
+ }
}
///
@@ -2307,6 +2320,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public override void AddNewClient(IClientAPI client)
{
+ CheckHeartbeat();
SubscribeToClientEvents(client);
ScenePresence presence;
@@ -2831,6 +2845,7 @@ namespace OpenSim.Region.Framework.Scenes
///
protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
{
+ CheckHeartbeat();
AvatarAppearance appearance = null;
GetAvatarAppearance(client, out appearance);
@@ -2873,6 +2888,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public override void RemoveClient(UUID agentID)
{
+ CheckHeartbeat();
bool childagentYN = false;
ScenePresence avatar = GetScenePresence(agentID);
if (avatar != null)
@@ -4374,6 +4390,8 @@ namespace OpenSim.Region.Framework.Scenes
else
return health;
+ CheckHeartbeat();
+
return health;
}
@@ -4559,5 +4577,11 @@ namespace OpenSim.Region.Framework.Scenes
return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z;
}
+
+ private void CheckHeartbeat()
+ {
+ if (System.Environment.TickCount - m_lastUpdate > 2000)
+ StartTimer();
+ }
}
}
--
cgit v1.1
From 998624544c5120676e3048990ef74956210be959 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 6 Sep 2009 16:14:45 +0100
Subject: Addendum to last commit. With the last commit, some other code that
should have been in this commit slipped in. If the last heartbeat is more
than 2 seconds ago, kill that thread and start a new one. Untested. his
commit adds support to let the first heartbeat complete unconditionally,
since it is almost always longer.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 8cd77f8..8f3ba97 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -225,6 +225,7 @@ namespace OpenSim.Region.Framework.Scenes
private int m_lastUpdate = Environment.TickCount;
private int m_maxPrimsPerFrame = 200;
+ private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object();
@@ -924,6 +925,7 @@ namespace OpenSim.Region.Framework.Scenes
Update();
m_lastUpdate = Environment.TickCount;
+ m_firstHeartbeat = false;
}
catch (ThreadAbortException)
{
@@ -4580,6 +4582,9 @@ namespace OpenSim.Region.Framework.Scenes
private void CheckHeartbeat()
{
+ if (m_firstHeartbeat)
+ return;
+
if (System.Environment.TickCount - m_lastUpdate > 2000)
StartTimer();
}
--
cgit v1.1