From eb590becf03d94d9afeef471c000c46b044d0c5b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 18 Jul 2012 00:14:02 +0100
Subject: Close() the ScenePresence after we've removed it from the scene
graph, to cut down race conditions when another thread manages the grab the
presence after some SP structures have been reset.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3e9583c..de2b192 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3317,24 +3317,30 @@ namespace OpenSim.Region.Framework.Scenes
if (AgentTransactionsModule != null)
AgentTransactionsModule.RemoveAgentAssetTransactions(agentID);
- avatar.Close();
-
m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
}
catch (Exception e)
{
m_log.Error(
- string.Format("[SCENE]: Exception removing {0} from {1}, ", avatar.Name, RegionInfo.RegionName), e);
+ string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e);
}
finally
{
- // Always clean these structures up so that any failure above doesn't cause them to remain in the
- // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
- // the same cleanup exception continually.
- // TODO: This should probably extend to the whole method, but we don't want to also catch the NRE
- // since this would hide the underlying failure and other associated problems.
- m_sceneGraph.RemoveScenePresence(agentID);
- m_clientManager.Remove(agentID);
+ try
+ {
+ // Always clean these structures up so that any failure above doesn't cause them to remain in the
+ // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
+ // the same cleanup exception continually.
+ m_sceneGraph.RemoveScenePresence(agentID);
+ m_clientManager.Remove(agentID);
+
+ avatar.Close();
+ }
+ catch (Exception e)
+ {
+ m_log.Error(
+ string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e);
+ }
}
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
--
cgit v1.1
From 0dd14ca0a3c78ea4b8d02b1024ac8be8404ae427 Mon Sep 17 00:00:00 2001
From: Dan Lake
Date: Wed, 18 Jul 2012 13:05:48 -0700
Subject: Missing parameter in log error message was throwing exception
---
OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 661e03c..305f8a4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.WarnFormat(
"[SCENE COMMUNICATION SERVICE]: Region {0} failed to inform neighbour at {1}-{2} that it is up.",
- x / Constants.RegionSize, y / Constants.RegionSize);
+ m_scene.Name, x / Constants.RegionSize, y / Constants.RegionSize);
}
}
--
cgit v1.1
From 6460e587c470361173291337ad222f48c13a10ce Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 18 Jul 2012 21:29:12 +0100
Subject: Pass entire scene object in OnLoginsEnabled event rather than just
the region name.
This saves listeners from having to re-retrieve the scene from their own lists, which won't work anyway if multiple regions with the same name have been allowed
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 7 +++----
OpenSim/Region/Framework/Scenes/Scene.cs | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index f92ed8e..e2380b7 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -496,14 +496,13 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void RegionHeartbeatEnd(Scene scene);
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
- public delegate void LoginsEnabled(string regionName);
-
///
/// This should only fire in all circumstances if the RegionReady module is active.
///
///
/// TODO: Fire this even when the RegionReady module is not active.
///
+ public delegate void LoginsEnabled(IScene scene);
public event LoginsEnabled OnLoginsEnabled;
public delegate void PrimsLoaded(Scene s);
@@ -2477,7 +2476,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void TriggerLoginsEnabled (string regionName)
+ public void TriggerLoginsEnabled(Scene scene)
{
LoginsEnabled handler = OnLoginsEnabled;
@@ -2487,7 +2486,7 @@ namespace OpenSim.Region.Framework.Scenes
{
try
{
- d(regionName);
+ d(scene);
}
catch (Exception e)
{
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index de2b192..8a28ee4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1493,7 +1493,7 @@ namespace OpenSim.Region.Framework.Scenes
{
// need to be able to tell these have changed in RegionReady
LoginLock = false;
- EventManager.TriggerLoginsEnabled(RegionInfo.RegionName);
+ EventManager.TriggerLoginsEnabled(this);
}
// For RegionReady lockouts
--
cgit v1.1
From 4973fddc51a4a9e3952bd2decd0ea1842b742141 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 18 Jul 2012 21:52:07 +0100
Subject: Establish EventManager.OnRegionReady event. This will only be
triggerred once when the region is ready.
Switch MapImageServiceModule to use this.
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 37 +++++++++++++++++++++++--
OpenSim/Region/Framework/Scenes/Scene.cs | 1 +
2 files changed, 35 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index e2380b7..714d70d 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -505,6 +505,16 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void LoginsEnabled(IScene scene);
public event LoginsEnabled OnLoginsEnabled;
+ ///
+ /// Fired when a region is considered ready for use.
+ ///
+ ///
+ /// A region is considered ready when startup operations such as loading of scripts already on the region
+ /// have been completed.
+ ///
+ public delegate void RegionReady(IScene scene);
+ public event RegionReady OnRegionReady;
+
public delegate void PrimsLoaded(Scene s);
public event PrimsLoaded OnPrimsLoaded;
@@ -2476,11 +2486,11 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void TriggerLoginsEnabled(Scene scene)
+ public void TriggerLoginsEnabled(IScene scene)
{
LoginsEnabled handler = OnLoginsEnabled;
- if ( handler != null)
+ if (handler != null)
{
foreach (LoginsEnabled d in handler.GetInvocationList())
{
@@ -2490,7 +2500,28 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception e)
{
- m_log.ErrorFormat("[EVENT MANAGER]: Delegate for LoginsEnabled failed - continuing {0} - {1}",
+ m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnLoginsEnabled failed - continuing {0} - {1}",
+ e.Message, e.StackTrace);
+ }
+ }
+ }
+ }
+
+ public void TriggerRegionReady(IScene scene)
+ {
+ RegionReady handler = OnRegionReady;
+
+ if (handler != null)
+ {
+ foreach (RegionReady d in handler.GetInvocationList())
+ {
+ try
+ {
+ d(scene);
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}",
e.Message, e.StackTrace);
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 8a28ee4..12cc0d3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1501,6 +1501,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
LoginsDisabled = false;
+ EventManager.TriggerRegionReady(this);
}
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo);
--
cgit v1.1
From 58b72933c814ed393bdf29622d218dd66805af4d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 18 Jul 2012 22:09:20 +0100
Subject: Fix bug where region ready was being triggered twice in quick
succession if a region contained no scripts.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 12cc0d3..cadcec0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1488,22 +1488,25 @@ namespace OpenSim.Region.Framework.Scenes
IConfig startupConfig = m_config.Configs["Startup"];
if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
{
- // This handles a case of a region having no scripts for the RegionReady module
- if (m_sceneGraph.GetActiveScriptsCount() == 0)
+ if (LoginLock)
{
- // need to be able to tell these have changed in RegionReady
- LoginLock = false;
- EventManager.TriggerLoginsEnabled(this);
+ // This handles a case of a region having no scripts for the RegionReady module
+ if (m_sceneGraph.GetActiveScriptsCount() == 0)
+ {
+ // XXX: need to be able to tell these have changed in RegionReady, since it will not
+ // detect a scenario where the region has no scripts - it's listening to the
+ // script compile queue.
+ EventManager.TriggerLoginsEnabled(this);
+ }
}
-
- // For RegionReady lockouts
- if (!LoginLock)
+ else
{
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
LoginsDisabled = false;
+ EventManager.TriggerLoginsEnabled(this);
EventManager.TriggerRegionReady(this);
}
-
+
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo);
}
else
--
cgit v1.1
From 528004d34988d8d2349f18ff7d78c6dd50ab8b2d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 18 Jul 2012 23:35:05 +0100
Subject: Perform other region ready actions even if simulator is configured to
leave logins disabled on startup.
---
.../Framework/Interfaces/IRegionReadyModule.cs | 11 ++++++-
OpenSim/Region/Framework/Scenes/EventManager.cs | 2 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 37 +++++++++++-----------
3 files changed, 29 insertions(+), 21 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs
index aa4a757..136ca92 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs
@@ -25,14 +25,23 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
using System;
+using OpenSim.Framework;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IRegionReadyModule
{
void OarLoadingAlert(string msg);
+
+ ///
+ /// Trigger region ready status manually.
+ ///
+ ///
+ /// This should be called by the scene if the IRegionReadyModule has set Scene.LoginLock == true
+ ///
+ ///
+ void TriggerRegionReady(IScene scene);
}
}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 714d70d..b8ae0ac 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -2506,7 +2506,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
-
+
public void TriggerRegionReady(IScene scene)
{
RegionReady handler = OnRegionReady;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index cadcec0..00aa0ea 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -702,6 +702,8 @@ namespace OpenSim.Region.Framework.Scenes
{
IConfig startupConfig = m_config.Configs["Startup"];
+ StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
+
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance);
m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
if (!m_useBackup)
@@ -1484,35 +1486,32 @@ namespace OpenSim.Region.Framework.Scenes
// this is a rare case where we know we have just went through a long cycle of heap
// allocations, and there is no more work to be done until someone logs in
GC.Collect();
-
- IConfig startupConfig = m_config.Configs["Startup"];
- if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
+
+ if (!LoginLock)
{
- if (LoginLock)
- {
- // This handles a case of a region having no scripts for the RegionReady module
- if (m_sceneGraph.GetActiveScriptsCount() == 0)
- {
- // XXX: need to be able to tell these have changed in RegionReady, since it will not
- // detect a scenario where the region has no scripts - it's listening to the
- // script compile queue.
- EventManager.TriggerLoginsEnabled(this);
- }
- }
- else
+ if (!StartDisabled)
{
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
LoginsDisabled = false;
EventManager.TriggerLoginsEnabled(this);
- EventManager.TriggerRegionReady(this);
}
- m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo);
+ // Region ready should always be triggered whether logins are immediately enabled or not.
+ EventManager.TriggerRegionReady(this);
}
else
{
- StartDisabled = true;
- LoginsDisabled = true;
+ // This handles a case of a region having no scripts for the RegionReady module
+ if (m_sceneGraph.GetActiveScriptsCount() == 0)
+ {
+ // In this case, we leave it to the IRegionReadyModule to enable logins
+
+ // LoginLock can currently only be set by a region module implementation.
+ // If somehow this hasn't been done then the quickest way to bugfix is to see the
+ // NullReferenceException
+ IRegionReadyModule rrm = RequestModuleInterface();
+ rrm.TriggerRegionReady(this);
+ }
}
}
}
--
cgit v1.1
From 64db0bcbd20ce7487a5f7751ba65d0e2f90b0704 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 18 Jul 2012 23:37:41 +0100
Subject: Add back notification to neighbouring regions when RegionReadyModule
is not active accidentally just removed in 528004d
---
OpenSim/Region/Framework/Scenes/Scene.cs | 3 +++
1 file changed, 3 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 00aa0ea..d4ccd41 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1496,6 +1496,9 @@ namespace OpenSim.Region.Framework.Scenes
EventManager.TriggerLoginsEnabled(this);
}
+ m_sceneGridService.InformNeighborsThatRegionisUp(
+ RequestModuleInterface(), RegionInfo);
+
// Region ready should always be triggered whether logins are immediately enabled or not.
EventManager.TriggerRegionReady(this);
}
--
cgit v1.1
From 6dda7c65ae1d58cac3e8dc2d9d64f56c870df39e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jul 2012 00:09:22 +0100
Subject: Add EventManager.OnRegionLoginsStatusChange fired whenever logins are
enabled or disabled at any point, not just during initial startup.
This replaces EventManager.OnLoginsEnabled which only fired when logins were first enabled
and was affected by a bug where it would never fire if the region started with logins disabled.
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 21 +++++++++++----------
OpenSim/Region/Framework/Scenes/Scene.cs | 10 +++++-----
OpenSim/Region/Framework/Scenes/SceneBase.cs | 18 ++++++++++++++++++
.../Scenes/Tests/ScenePresenceTeleportTests.cs | 2 +-
4 files changed, 35 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index b8ae0ac..620b605 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -497,13 +497,14 @@ namespace OpenSim.Region.Framework.Scenes
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
///
- /// This should only fire in all circumstances if the RegionReady module is active.
+ /// Fired when logins to a region are enabled or disabled.
///
///
- /// TODO: Fire this even when the RegionReady module is not active.
+ ///
///
- public delegate void LoginsEnabled(IScene scene);
- public event LoginsEnabled OnLoginsEnabled;
+ /// Fired
+ public event RegionLoginsStatusChange OnRegionLoginsStatusChange;
+ public delegate void RegionLoginsStatusChange(IScene scene);
///
/// Fired when a region is considered ready for use.
@@ -512,8 +513,8 @@ namespace OpenSim.Region.Framework.Scenes
/// A region is considered ready when startup operations such as loading of scripts already on the region
/// have been completed.
///
- public delegate void RegionReady(IScene scene);
public event RegionReady OnRegionReady;
+ public delegate void RegionReady(IScene scene);
public delegate void PrimsLoaded(Scene s);
public event PrimsLoaded OnPrimsLoaded;
@@ -2486,13 +2487,13 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void TriggerLoginsEnabled(IScene scene)
+ public void TriggerRegionLoginsStatusChange(IScene scene)
{
- LoginsEnabled handler = OnLoginsEnabled;
+ RegionLoginsStatusChange handler = OnRegionLoginsStatusChange;
if (handler != null)
{
- foreach (LoginsEnabled d in handler.GetInvocationList())
+ foreach (RegionLoginsStatusChange d in handler.GetInvocationList())
{
try
{
@@ -2500,13 +2501,13 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception e)
{
- m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnLoginsEnabled failed - continuing {0} - {1}",
+ m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionLoginsStatusChange failed - continuing {0} - {1}",
e.Message, e.StackTrace);
}
}
}
}
-
+
public void TriggerRegionReady(IScene scene)
{
RegionReady handler = OnRegionReady;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d4ccd41..6d8ee7b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -128,9 +128,10 @@ namespace OpenSim.Region.Framework.Scenes
// root agents when ACL denies access to root agent
public bool m_strictAccessControl = true;
public int MaxUndoCount = 5;
+
// Using this for RegionReady module to prevent LoginsDisabled from changing under our feet;
public bool LoginLock = false;
- public bool LoginsDisabled = true;
+
public bool StartDisabled = false;
public bool LoadingPrims;
public IXfer XferManager;
@@ -1478,7 +1479,7 @@ namespace OpenSim.Region.Framework.Scenes
// landMS = Util.EnvironmentTickCountSubtract(ldMS);
//}
- if (LoginsDisabled && Frame == 20)
+ if (!LoginsEnabled && Frame == 20)
{
// m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock);
@@ -1492,8 +1493,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!StartDisabled)
{
m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
- LoginsDisabled = false;
- EventManager.TriggerLoginsEnabled(this);
+ LoginsEnabled = true;
}
m_sceneGridService.InformNeighborsThatRegionisUp(
@@ -3460,7 +3460,7 @@ namespace OpenSim.Region.Framework.Scenes
agent.startpos
);
- if (LoginsDisabled)
+ if (!LoginsEnabled)
{
reason = "Logins Disabled";
return false;
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index f50fbfc..282fc5e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -106,6 +106,24 @@ namespace OpenSim.Region.Framework.Scenes
protected readonly ClientManager m_clientManager = new ClientManager();
+ public bool LoginsEnabled
+ {
+ get
+ {
+ return m_loginsEnabled;
+ }
+
+ set
+ {
+ if (m_loginsEnabled != value)
+ {
+ m_loginsEnabled = value;
+ EventManager.TriggerRegionLoginsStatusChange(this);
+ }
+ }
+ }
+ private bool m_loginsEnabled;
+
public float TimeDilation
{
get { return 1.0f; }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index a407f01..37b5184 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -301,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
sp.AbsolutePosition = preTeleportPosition;
// Make sceneB refuse CreateAgent
- sceneB.LoginsDisabled = true;
+ sceneB.LoginsEnabled = false;
sceneA.RequestTeleportLocation(
sp.ControllingClient,
--
cgit v1.1
From c0ab406e2e3ab1e1702285c7cd35e1adc6cc593b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jul 2012 21:41:13 +0100
Subject: Add basic TestCreateRootScenePresence() regression test
---
.../Scenes/Tests/ScenePresenceAgentTests.cs | 279 +++++++++++----------
1 file changed, 144 insertions(+), 135 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 02c45ef..44c1396 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -53,48 +53,60 @@ namespace OpenSim.Region.Framework.Scenes.Tests
/// Scene presence tests
///
[TestFixture]
- public class ScenePresenceAgentTests
+ public class ScenePresenceAgentTests : OpenSimTestCase
{
- public Scene scene, scene2, scene3;
- public UUID agent1, agent2, agent3;
- public static Random random;
- public ulong region1,region2,region3;
- public AgentCircuitData acd1;
- public SceneObjectGroup sog1, sog2, sog3;
- public TestClient testclient;
-
- [TestFixtureSetUp]
- public void Init()
+// public Scene scene, scene2, scene3;
+// public UUID agent1, agent2, agent3;
+// public static Random random;
+// public ulong region1, region2, region3;
+// public AgentCircuitData acd1;
+// public TestClient testclient;
+
+// [TestFixtureSetUp]
+// public void Init()
+// {
+//// TestHelpers.InMethod();
+////
+//// SceneHelpers sh = new SceneHelpers();
+////
+//// scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
+//// scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
+//// scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
+////
+//// ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
+//// interregionComms.Initialise(new IniConfigSource());
+//// interregionComms.PostInitialise();
+//// SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
+//// SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
+//// SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
+//
+//// agent1 = UUID.Random();
+//// agent2 = UUID.Random();
+//// agent3 = UUID.Random();
+//
+//// region1 = scene.RegionInfo.RegionHandle;
+//// region2 = scene2.RegionInfo.RegionHandle;
+//// region3 = scene3.RegionInfo.RegionHandle;
+// }
+
+ [Test]
+ public void TestCreateRootScenePresence()
{
TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID spUuid = TestHelpers.ParseTail(0x1);
+
+ TestScene scene = new SceneHelpers().SetupScene();
+ SceneHelpers.AddScenePresence(scene, spUuid);
+
+ Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
+ Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
- SceneHelpers sh = new SceneHelpers();
-
- scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
- scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
- scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);
-
- ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
- interregionComms.Initialise(new IniConfigSource());
- interregionComms.PostInitialise();
- SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
- SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
- SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
-
- agent1 = UUID.Random();
- agent2 = UUID.Random();
- agent3 = UUID.Random();
- random = new Random();
- sog1 = SceneHelpers.CreateSceneObject(1, agent1);
- scene.AddSceneObject(sog1);
- sog2 = SceneHelpers.CreateSceneObject(1, agent1);
- scene.AddSceneObject(sog2);
- sog3 = SceneHelpers.CreateSceneObject(1, agent1);
- scene.AddSceneObject(sog3);
-
- region1 = scene.RegionInfo.RegionHandle;
- region2 = scene2.RegionInfo.RegionHandle;
- region3 = scene3.RegionInfo.RegionHandle;
+ ScenePresence sp = scene.GetScenePresence(spUuid);
+ Assert.That(sp, Is.Not.Null);
+ Assert.That(sp.IsChildAgent, Is.False);
+ Assert.That(sp.UUID, Is.EqualTo(spUuid));
}
[Test]
@@ -106,9 +118,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene scene = new SceneHelpers().SetupScene();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
- Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null);
- Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
-
scene.IncomingCloseAgent(sp.UUID);
Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
@@ -266,99 +275,99 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// but things are synchronous among them. So there should be
// 3 threads in here.
//[Test]
- public void T021_TestCrossToNewRegion()
- {
- TestHelpers.InMethod();
-
- scene.RegisterRegionWithGrid();
- scene2.RegisterRegionWithGrid();
-
- // Adding child agent to region 1001
- string reason;
- scene2.NewUserConnection(acd1,0, out reason);
- scene2.AddNewClient(testclient, PresenceType.User);
-
- ScenePresence presence = scene.GetScenePresence(agent1);
- presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
-
- ScenePresence presence2 = scene2.GetScenePresence(agent1);
-
- // Adding neighbour region caps info to presence2
-
- string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
- presence2.AddNeighbourRegion(region1, cap);
-
- Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
- Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
-
- // Cross to x+1
- presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
- presence.Update();
-
- EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
-
- // Mimicking communication between client and server, by waiting OK from client
- // sent by TestClient.CrossRegion call. Originally, this is network comm.
- if (!wh.WaitOne(5000,false))
- {
- presence.Update();
- if (!wh.WaitOne(8000,false))
- throw new ArgumentException("1 - Timeout waiting for signal/variable.");
- }
-
- // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
- // would normally be fired after receiving the reply packet from comm. done on the last line.
- testclient.CompleteMovement();
-
- // Crossings are asynchronous
- int timer = 10;
-
- // Make sure cross hasn't already finished
- if (!presence.IsInTransit && !presence.IsChildAgent)
- {
- // If not and not in transit yet, give it some more time
- Thread.Sleep(5000);
- }
-
- // Enough time, should at least be in transit by now.
- while (presence.IsInTransit && timer > 0)
- {
- Thread.Sleep(1000);
- timer-=1;
- }
-
- Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
- Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
- Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
-
- // Cross Back
- presence2.AbsolutePosition = new Vector3(-10, 3, 100);
- presence2.Update();
-
- if (!wh.WaitOne(5000,false))
- {
- presence2.Update();
- if (!wh.WaitOne(8000,false))
- throw new ArgumentException("2 - Timeout waiting for signal/variable.");
- }
- testclient.CompleteMovement();
-
- if (!presence2.IsInTransit && !presence2.IsChildAgent)
- {
- // If not and not in transit yet, give it some more time
- Thread.Sleep(5000);
- }
-
- // Enough time, should at least be in transit by now.
- while (presence2.IsInTransit && timer > 0)
- {
- Thread.Sleep(1000);
- timer-=1;
- }
-
- Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
- Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
- Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
- }
+// public void T021_TestCrossToNewRegion()
+// {
+// TestHelpers.InMethod();
+//
+// scene.RegisterRegionWithGrid();
+// scene2.RegisterRegionWithGrid();
+//
+// // Adding child agent to region 1001
+// string reason;
+// scene2.NewUserConnection(acd1,0, out reason);
+// scene2.AddNewClient(testclient, PresenceType.User);
+//
+// ScenePresence presence = scene.GetScenePresence(agent1);
+// presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
+//
+// ScenePresence presence2 = scene2.GetScenePresence(agent1);
+//
+// // Adding neighbour region caps info to presence2
+//
+// string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
+// presence2.AddNeighbourRegion(region1, cap);
+//
+// Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
+// Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
+//
+// // Cross to x+1
+// presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
+// presence.Update();
+//
+// EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
+//
+// // Mimicking communication between client and server, by waiting OK from client
+// // sent by TestClient.CrossRegion call. Originally, this is network comm.
+// if (!wh.WaitOne(5000,false))
+// {
+// presence.Update();
+// if (!wh.WaitOne(8000,false))
+// throw new ArgumentException("1 - Timeout waiting for signal/variable.");
+// }
+//
+// // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
+// // would normally be fired after receiving the reply packet from comm. done on the last line.
+// testclient.CompleteMovement();
+//
+// // Crossings are asynchronous
+// int timer = 10;
+//
+// // Make sure cross hasn't already finished
+// if (!presence.IsInTransit && !presence.IsChildAgent)
+// {
+// // If not and not in transit yet, give it some more time
+// Thread.Sleep(5000);
+// }
+//
+// // Enough time, should at least be in transit by now.
+// while (presence.IsInTransit && timer > 0)
+// {
+// Thread.Sleep(1000);
+// timer-=1;
+// }
+//
+// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
+// Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
+// Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
+//
+// // Cross Back
+// presence2.AbsolutePosition = new Vector3(-10, 3, 100);
+// presence2.Update();
+//
+// if (!wh.WaitOne(5000,false))
+// {
+// presence2.Update();
+// if (!wh.WaitOne(8000,false))
+// throw new ArgumentException("2 - Timeout waiting for signal/variable.");
+// }
+// testclient.CompleteMovement();
+//
+// if (!presence2.IsInTransit && !presence2.IsChildAgent)
+// {
+// // If not and not in transit yet, give it some more time
+// Thread.Sleep(5000);
+// }
+//
+// // Enough time, should at least be in transit by now.
+// while (presence2.IsInTransit && timer > 0)
+// {
+// Thread.Sleep(1000);
+// timer-=1;
+// }
+//
+// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
+// Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
+// Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
+// }
}
}
\ No newline at end of file
--
cgit v1.1
From e9a121e1b203e8880bcaf85d35612fc6706b281a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jul 2012 21:54:50 +0100
Subject: Add TestCreateDuplicateRootScenePresence() regression test.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 17 ++++++++++++++++
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +-
.../Scenes/Tests/ScenePresenceAgentTests.cs | 23 ++++++++++++++++++++++
3 files changed, 41 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 6d8ee7b..36452de 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4470,6 +4470,23 @@ namespace OpenSim.Region.Framework.Scenes
}
///
+ /// Gets all the scene presences in this scene.
+ ///
+ ///
+ /// This method will return both root and child scene presences.
+ ///
+ /// Consider using ForEachScenePresence() or ForEachRootScenePresence() if possible since these will not
+ /// involving creating a new List object.
+ ///
+ ///
+ /// A list of the scene presences. Adding or removing from the list will not affect the presences in the scene.
+ ///
+ public List GetScenePresences()
+ {
+ return new List(m_sceneGraph.GetScenePresences());
+ }
+
+ ///
/// Performs action on all avatars in the scene (root scene presences)
/// Avatars may be an NPC or a 'real' client.
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 2be5364..ba68dfa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -768,7 +768,7 @@ namespace OpenSim.Region.Framework.Scenes
/// pass a delegate to ForEachScenePresence.
///
///
- private List GetScenePresences()
+ protected internal List GetScenePresences()
{
return m_scenePresenceArray;
}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 44c1396..5758869 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -107,6 +107,29 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(sp, Is.Not.Null);
Assert.That(sp.IsChildAgent, Is.False);
Assert.That(sp.UUID, Is.EqualTo(spUuid));
+
+ Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
+ }
+
+ [Test]
+ public void TestCreateDuplicateRootScenePresence()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID spUuid = TestHelpers.ParseTail(0x1);
+
+ TestScene scene = new SceneHelpers().SetupScene();
+ SceneHelpers.AddScenePresence(scene, spUuid);
+ SceneHelpers.AddScenePresence(scene, spUuid);
+
+ Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
+ Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
+
+ ScenePresence sp = scene.GetScenePresence(spUuid);
+ Assert.That(sp, Is.Not.Null);
+ Assert.That(sp.IsChildAgent, Is.False);
+ Assert.That(sp.UUID, Is.EqualTo(spUuid));
}
[Test]
--
cgit v1.1
From ba80f137b58cfacf46fadb3ec8b63af6896c5b43 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jul 2012 22:32:27 +0100
Subject: Prevent race conditions between two threads that call
LLClientView.Close() simultaneously (e.g. ack timeout and an attempt to
reconnect)
---
OpenSim/Region/Framework/Scenes/Scene.cs | 6 +++---
1 file changed, 3 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 36452de..51a6820 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3517,8 +3517,8 @@ namespace OpenSim.Region.Framework.Scenes
// We have a zombie from a crashed session.
// Or the same user is trying to be root twice here, won't work.
// Kill it.
- m_log.DebugFormat(
- "[SCENE]: Zombie scene presence detected for {0} {1} in {2}",
+ m_log.WarnFormat(
+ "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.",
sp.Name, sp.UUID, RegionInfo.RegionName);
sp.ControllingClient.Close();
@@ -4474,7 +4474,7 @@ namespace OpenSim.Region.Framework.Scenes
///
///
/// This method will return both root and child scene presences.
- ///
+ ///
/// Consider using ForEachScenePresence() or ForEachRootScenePresence() if possible since these will not
/// involving creating a new List object.
///
--
cgit v1.1
From e94831ddab282f2d84d0dad0b28e7cce6ac4c4b0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 19 Jul 2012 22:59:28 +0100
Subject: Stop explicitly closing and nulling out Animator in order to prevent
NREs in various places due to race conditions.
Even where checks are being made they aren't enough since they all assume that the Animator they just checked is still there in the next line, which is not necessarily the case without locking.
The memory used is small and these should be GC'd anyway when the SP is released. If this is not happening then the wider problem of old SPs being retained needs to be resolved.
---
.../Scenes/Animation/ScenePresenceAnimator.cs | 8 +-------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 22 ++++++----------------
2 files changed, 7 insertions(+), 23 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 14ae287..ff53f45 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -535,11 +535,5 @@ namespace OpenSim.Region.Framework.Scenes.Animation
SendAnimPack(animIDs, sequenceNums, objectIDs);
}
-
- public void Close()
- {
- m_animations = null;
- m_scenePresence = null;
- }
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0e7f2e5..548dfd3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -109,15 +109,10 @@ namespace OpenSim.Region.Framework.Scenes
public UUID currentParcelUUID = UUID.Zero;
- protected ScenePresenceAnimator m_animator;
///
/// The animator for this avatar
///
- public ScenePresenceAnimator Animator
- {
- get { return m_animator; }
- private set { m_animator = value; }
- }
+ public ScenePresenceAnimator Animator { get; private set; }
///
/// Attachments recorded on this avatar.
@@ -2569,8 +2564,7 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
avatar.ControllingClient.SendAvatarDataImmediate(this);
- if (Animator != null)
- Animator.SendAnimPackToClient(avatar.ControllingClient);
+ Animator.SendAnimPackToClient(avatar.ControllingClient);
}
///
@@ -3239,14 +3233,12 @@ namespace OpenSim.Region.Framework.Scenes
//if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
// The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
// as of this comment the interval is set in AddToPhysicalScene
- if (Animator != null)
- {
+
// if (m_updateCount > 0)
// {
- Animator.UpdateMovementAnimations();
+ Animator.UpdateMovementAnimations();
// m_updateCount--;
// }
- }
CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
Dictionary coldata = collisionData.m_objCollisionList;
@@ -3261,7 +3253,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_lastColCount = coldata.Count;
// }
- if (coldata.Count != 0 && Animator != null)
+ if (coldata.Count != 0)
{
switch (Animator.CurrentMovementAnimation)
{
@@ -3371,7 +3363,7 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.SendHealth(Health);
}
- public void Close()
+ protected internal void Close()
{
// Clear known regions
KnownRegions = new Dictionary();
@@ -3387,8 +3379,6 @@ namespace OpenSim.Region.Framework.Scenes
// m_reprioritizationTimer.Dispose();
RemoveFromPhysicalScene();
- Animator.Close();
- Animator = null;
}
public void AddAttachment(SceneObjectGroup gobj)
--
cgit v1.1
From fc77bca936e7d28b4e92a73289124b41cd50b553 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 23 Jul 2012 19:53:26 +0100
Subject: Committing Avination's memleak fix-a-thon, installment #3 When
linking, detach the no longer used SOG's from backup so they can be
collected. Since their Children collection is never emptied, they prevent
their former SOPs from being collected as well.
---
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 ++
1 file changed, 2 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index ba68dfa..13842ad 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1638,6 +1638,8 @@ namespace OpenSim.Region.Framework.Scenes
{
parentGroup.LinkToGroup(child);
+ child.DetachFromBackup();
+
// this is here so physics gets updated!
// Don't remove! Bad juju! Stay away! or fix physics!
child.AbsolutePosition = child.AbsolutePosition;
--
cgit v1.1
From e126915bc168f16f2c4462492814a1b733aefe87 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Mon, 23 Jul 2012 21:08:02 +0200
Subject: Change attachment handling to remove object from the scene first as
per justincc's original work. Sample scripts before doing so. Also refactor
some crucial common code and eliminate parameters that were only ever used
with the same constant value.
---
.../Region/Framework/Interfaces/IAttachmentsModule.cs | 2 +-
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 4 +++-
OpenSim/Region/Framework/Scenes/Scene.cs | 12 +-----------
.../Scenes/Serialization/SceneObjectSerializer.cs | 18 ++++++++++++++++++
4 files changed, 23 insertions(+), 13 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 351e603..d5200b7 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// The presence closing
/// Save changed attachments.
/// Save attachments with scripts even if they haven't changed.
- void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted);
+ void DeRezAttachments(IScenePresence sp);
///
/// Delete all the presence's attachments from the scene
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index e6b926c..3f68ee0 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -40,6 +40,8 @@ namespace OpenSim.Region.Framework.Interfaces
///
public interface IScenePresence : ISceneAgent
{
+ PresenceType PresenceType { get; }
+
///
/// Copy of the script states while the agent is in transit. This state may
/// need to be placed back in case of transfer fail.
@@ -83,4 +85,4 @@ namespace OpenSim.Region.Framework.Interfaces
void RemoveAttachment(SceneObjectGroup gobj);
void ClearAttachments();
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 51a6820..ee34338 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3297,17 +3297,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (AttachmentsModule != null)
{
- // Don't save attachments for HG visitors, it
- // messes up their inventory. When a HG visitor logs
- // out on a foreign grid, their attachments will be
- // reloaded in the state they were in when they left
- // the home grid. This is best anyway as the visited
- // grid may use an incompatible script engine.
- bool saveChanged
- = avatar.PresenceType != PresenceType.Npc
- && (UserManagementModule == null || UserManagementModule.IsLocalGridUser(avatar.UUID));
-
- AttachmentsModule.DeRezAttachments(avatar, saveChanged, false);
+ AttachmentsModule.DeRezAttachments(avatar);
}
ForEachClient(
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 0b34156..2d4c60a 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -151,6 +151,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
ToOriginalXmlFormat(sceneObject, writer, doScriptStates, false);
}
+ public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject, string scriptedState)
+ {
+ using (StringWriter sw = new StringWriter())
+ {
+ using (XmlTextWriter writer = new XmlTextWriter(sw))
+ {
+ writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
+
+ ToOriginalXmlFormat(sceneObject, writer, false, true);
+
+ writer.WriteRaw(scriptedState);
+
+ writer.WriteEndElement();
+ }
+ return sw.ToString();
+ }
+ }
+
///
/// Serialize a scene object to the original xml format
///
--
cgit v1.1
From 31304c222df1e5a832afd0ebcf7d3ed403543e54 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 25 Jul 2012 21:00:59 +0100
Subject: Make SceneManager.OnRegionsReadyStatusChange event available.
This is fired when all regions are ready or when at least one region becomes not ready.
Recently added EventManager.OnRegionReady becomes OnRegionReadyStatusChange to match OnLoginsEnabledStatusChange
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 11 +++--
OpenSim/Region/Framework/Scenes/Scene.cs | 4 +-
OpenSim/Region/Framework/Scenes/SceneBase.cs | 18 +++++++++
OpenSim/Region/Framework/Scenes/SceneManager.cs | 53 ++++++++++++++++++++++++-
4 files changed, 76 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 620b605..6dea2f0 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -513,8 +513,7 @@ namespace OpenSim.Region.Framework.Scenes
/// A region is considered ready when startup operations such as loading of scripts already on the region
/// have been completed.
///
- public event RegionReady OnRegionReady;
- public delegate void RegionReady(IScene scene);
+ public event Action OnRegionReadyStatusChange;
public delegate void PrimsLoaded(Scene s);
public event PrimsLoaded OnPrimsLoaded;
@@ -2508,13 +2507,13 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void TriggerRegionReady(IScene scene)
+ public void TriggerRegionReadyStatusChange(IScene scene)
{
- RegionReady handler = OnRegionReady;
+ Action handler = OnRegionReadyStatusChange;
if (handler != null)
{
- foreach (RegionReady d in handler.GetInvocationList())
+ foreach (Action d in handler.GetInvocationList())
{
try
{
@@ -2522,7 +2521,7 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception e)
{
- m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReady failed - continuing {0} - {1}",
+ m_log.ErrorFormat("[EVENT MANAGER]: Delegate for OnRegionReadyStatusChange failed - continuing {0} - {1}",
e.Message, e.StackTrace);
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ee34338..20918bd 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1499,8 +1499,8 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.InformNeighborsThatRegionisUp(
RequestModuleInterface(), RegionInfo);
- // Region ready should always be triggered whether logins are immediately enabled or not.
- EventManager.TriggerRegionReady(this);
+ // Region ready should always be set
+ Ready = true;
}
else
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 282fc5e..b87a38a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -124,6 +124,24 @@ namespace OpenSim.Region.Framework.Scenes
}
private bool m_loginsEnabled;
+ public bool Ready
+ {
+ get
+ {
+ return m_ready;
+ }
+
+ set
+ {
+ if (m_ready != value)
+ {
+ m_ready = value;
+ EventManager.TriggerRegionReadyStatusChange(this);
+ }
+ }
+ }
+ private bool m_ready;
+
public float TimeDilation
{
get { return 1.0f; }
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index d73a959..c81b55d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -47,6 +47,48 @@ namespace OpenSim.Region.Framework.Scenes
public event RestartSim OnRestartSim;
+ ///
+ /// Fired when either all regions are ready for use or at least one region has become unready for use where
+ /// previously all regions were ready.
+ ///
+ public event Action OnRegionsReadyStatusChange;
+
+ ///
+ /// Are all regions ready for use?
+ ///
+ public bool AllRegionsReady
+ {
+ get
+ {
+ return m_allRegionsReady;
+ }
+
+ private set
+ {
+ if (m_allRegionsReady != value)
+ {
+ m_allRegionsReady = value;
+ Action handler = OnRegionsReadyStatusChange;
+ if (handler != null)
+ {
+ foreach (Action d in handler.GetInvocationList())
+ {
+ try
+ {
+ d(this);
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[SCENE MANAGER]: Delegate for OnRegionsReadyStatusChange failed - continuing {0} - {1}",
+ e.Message, e.StackTrace);
+ }
+ }
+ }
+ }
+ }
+ }
+ private bool m_allRegionsReady;
+
private static SceneManager m_instance = null;
public static SceneManager Instance
{
@@ -141,10 +183,11 @@ namespace OpenSim.Region.Framework.Scenes
public void Add(Scene scene)
{
- scene.OnRestart += HandleRestart;
-
lock (m_localScenes)
m_localScenes.Add(scene);
+
+ scene.OnRestart += HandleRestart;
+ scene.EventManager.OnRegionReadyStatusChange += HandleRegionReadyStatusChange;
}
public void HandleRestart(RegionInfo rdata)
@@ -175,6 +218,12 @@ namespace OpenSim.Region.Framework.Scenes
OnRestartSim(rdata);
}
+ private void HandleRegionReadyStatusChange(IScene scene)
+ {
+ lock (m_localScenes)
+ AllRegionsReady = m_localScenes.TrueForAll(s => s.Ready);
+ }
+
public void SendSimOnlineNotification(ulong regionHandle)
{
RegionInfo Result = null;
--
cgit v1.1
From 35efa88c26d249d315837fdca0faf643511e1a4e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 25 Jul 2012 23:11:50 +0100
Subject: Rename OpenSim.Framework.Statistics to OpenSim.Framework.Monitoring.
This better reflects the long-term purpose of that project and matches Monitoring modules.
---
OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs | 2 +-
OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
index 1365831..c11174d 100644
--- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
+++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs
@@ -39,7 +39,7 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
-using OpenSim.Framework.Statistics;
+using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 742d42a..96317c3 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
using System.Timers;
using OpenMetaverse.Packets;
using OpenSim.Framework;
-using OpenSim.Framework.Statistics;
+using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes
--
cgit v1.1
From 5aec0ff207e9427b8756471eb003fd68859f67b1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 25 Jul 2012 23:27:00 +0100
Subject: Move Watchdog and MemoryWatchdog classes into
OpenSim.Framework.Monitoring with other monitoring code from
OpenSim.Framework
---
OpenSim/Region/Framework/Scenes/Scene.cs | 1 +
1 file changed, 1 insertion(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 20918bd..24f62e3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -40,6 +40,7 @@ using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenMetaverse.Imaging;
using OpenSim.Framework;
+using OpenSim.Framework.Monitoring;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Console;
--
cgit v1.1
From c1503205c028437507e2b8e4ab90e1258b1e9d60 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Thu, 26 Jul 2012 15:27:18 -0700
Subject: Add a Dispose() of the physics engine when a scene is being shutdown.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++++++
1 file changed, 9 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 24f62e3..1734704 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1222,6 +1222,15 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.Close();
+ if (PhysicsScene != null)
+ {
+ PhysicsScene phys = PhysicsScene;
+ // remove the physics engine from both Scene and SceneGraph
+ PhysicsScene = null;
+ phys.Dispose();
+ phys = null;
+ }
+
if (!GridService.DeregisterRegion(RegionInfo.RegionID))
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", Name);
--
cgit v1.1
From 66824dd18c331423914e0df414edb662ddf43869 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 26 Jul 2012 23:44:29 +0100
Subject: When copying items, copy the item description field instead of the
asset description field.
If we copy the asset description then we will only ever replicate the very first description, if there was one, not any subsequent changes.
Thanks to Oren Hurvitz of Kitely for this patch from http://opensimulator.org/mantis/view.php?id=6107
I have adapted it slightly to change the order of arguments (name before description rather than vice-versa) and slightly improve some method doc.
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 69 ++++++++++++++--------
1 file changed, 46 insertions(+), 23 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index e413281..d18fffd 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -814,16 +814,20 @@ namespace OpenSim.Region.Framework.Scenes
&& oldAgentID == LibraryService.LibraryRootFolder.Owner))
{
CreateNewInventoryItem(
- remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
- item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
+ remoteClient, item.CreatorId, item.CreatorData, newFolderID,
+ newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType,
+ item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
+ item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
}
else
{
// If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
- if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) && (m_permissions.BypassPermissions() || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
+ if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
+ && (m_permissions.BypassPermissions()
+ || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
{
CreateNewInventoryItem(
- remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID,
+ remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
asset, (sbyte) item.InvType,
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
@@ -870,32 +874,50 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Create a new inventory item.
///
- ///
- ///
- ///
- ///
- ///
- ///
- public void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID,
- AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate)
+ /// Client creating this inventory item.
+ ///
+ ///
+ /// UUID of folder in which this item should be placed.
+ /// Item name.
+ /// Item description.
+ /// Item flags
+ /// Generated by the client.
+ /// Asset to which this item refers.
+ /// Type of inventory item.
+ /// Next owner pemrissions mask.
+ /// Unix timestamp at which this item was created.
+ public void CreateNewInventoryItem(
+ IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
+ string name, string description, uint flags, uint callbackID,
+ AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate)
{
CreateNewInventoryItem(
- remoteClient, creatorID, creatorData, folderID, name, flags, callbackID, asset, invType,
+ remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate);
}
///
/// Create a new Inventory Item
///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
+ /// Client creating this inventory item.
+ ///
+ ///
+ /// UUID of folder in which this item should be placed.
+ /// Item name.
+ /// Item description.
+ /// Item flags
+ /// Generated by the client.
+ /// Asset to which this item refers.
+ /// Type of inventory item.
+ /// Base permissions mask.
+ /// Current permissions mask.
+ /// Everyone permissions mask.
+ /// Next owner pemrissions mask.
+ /// Group permissions mask.
+ /// Unix timestamp at which this item was created.
private void CreateNewInventoryItem(
- IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType,
+ IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
+ string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
{
InventoryItemBase item = new InventoryItemBase();
@@ -904,8 +926,8 @@ namespace OpenSim.Region.Framework.Scenes
item.CreatorData = creatorData;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
- item.Description = asset.Description;
item.Name = name;
+ item.Description = description;
item.Flags = flags;
item.AssetType = asset.Type;
item.InvType = invType;
@@ -987,7 +1009,8 @@ namespace OpenSim.Region.Framework.Scenes
asset.Description = description;
CreateNewInventoryItem(
- remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType,
+ remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
+ name, description, 0, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
(uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
}
--
cgit v1.1
From 0d9afad3fecd13b06065af556ed9a01f8a745f44 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 27 Jul 2012 22:15:25 +0100
Subject: Remove duplicated IScenePresence.PresenceType. This is already in
ISceneAgent.PresenceType from which IScenePresence inherits.
No other code changes required.
---
OpenSim/Region/Framework/Interfaces/IScenePresence.cs | 2 --
1 file changed, 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 3f68ee0..0fe681f 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -40,8 +40,6 @@ namespace OpenSim.Region.Framework.Interfaces
///
public interface IScenePresence : ISceneAgent
{
- PresenceType PresenceType { get; }
-
///
/// Copy of the script states while the agent is in transit. This state may
/// need to be placed back in case of transfer fail.
--
cgit v1.1
From 7e89b99e6ad93a313338099f9033adafa26ee426 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 27 Jul 2012 23:58:53 +0100
Subject: Avoid a race condition between the scene shutdown thread and the
update thread since commit c150320 (Thu Jul 26 15:27:18 2012)
c150320 started explicitly disposing of the physics scene and nulling it out on region shutdown.
However, the update loop may not have yet checked Scene.ShuttingDown, particularly if avatars were not in the scene, causing failure when it tried to lookup time dilation.
This commit moves the setting of m_shuttingDown above the existing 500ms pause to notify avatars that they are being kicked.
This should not affect the few other places that use this flag.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 8 +++++---
1 file changed, 5 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 1734704..eb4ba41 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1199,15 +1199,17 @@ namespace OpenSim.Region.Framework.Scenes
avatar.ControllingClient.SendShutdownConnectionNotice();
});
+ // Stop updating the scene objects and agents.
+ m_shuttingDown = true;
+
// Wait here, or the kick messages won't actually get to the agents before the scene terminates.
+ // We also need to wait to avoid a race condition with the scene update loop which might not yet
+ // have checked ShuttingDown.
Thread.Sleep(500);
// Stop all client threads.
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
- // Stop updating the scene objects and agents.
- m_shuttingDown = true;
-
m_log.Debug("[SCENE]: Persisting changed objects");
EventManager.TriggerSceneShuttingDown(this);
--
cgit v1.1
From 45b72bf01c99697e65b6cda5515bbadc4a9442da Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sat, 28 Jul 2012 01:06:28 +0100
Subject: Fix some merge issues and a functional issue in the scene manager
---
OpenSim/Region/Framework/Scenes/SceneManager.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index a412414..f1b09ca 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes
private void HandleRegionReadyStatusChange(IScene scene)
{
lock (m_localScenes)
- AllRegionsReady = m_localScenes.TrueForAll(s => s.Ready);
+ AllRegionsReady = m_localScenes.FindAll(s => !s.Ready).Count == 0;
}
public void SendSimOnlineNotification(ulong regionHandle)
--
cgit v1.1
From a76a289d11086dd99d345390e58a43b66b053470 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Tue, 31 Jul 2012 10:45:37 -0700
Subject: Adds support to ScriptModuleComms for region modules to export
constants to the script engine.
---
OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
index bfe1e8d..ed71a95 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModuleComms.cs
@@ -67,6 +67,10 @@ namespace OpenSim.Region.Framework.Interfaces
///
void DispatchReply(UUID scriptId, int code, string text, string key);
+ /// For constants
+ void RegisterConstant(string cname, object value);
+ object LookupModConstant(string cname);
+
// For use ONLY by the script API
void RaiseEvent(UUID script, string id, string module, string command, string key);
}
--
cgit v1.1
From cf16ca9bdaad75d42213089e18c0ee8f8422bbd6 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 1 Aug 2012 22:36:24 +0100
Subject: Create the ability for physics modules to request assets on demand by
themselves. For that, the physics module simply calls RequestAssetMethod,
which in turn points to Scene.PhysicsRequestAsset. This gives physics access
to the asset system without introducing unwanted knowledge of the scene
class.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index eb4ba41..c77457c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5421,5 +5421,21 @@ namespace OpenSim.Region.Framework.Scenes
m_SpawnPoint = 1;
return m_SpawnPoint - 1;
}
+
+ // Wrappers to get physics modules retrieve assets. Has to be done this way
+ // because we can't assign the asset service to physics directly - at the
+ // time physics are instantiated it's not registered but it will be by
+ // the time the first prim exists.
+ public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback)
+ {
+ AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived);
+ }
+
+ private void PhysicsAssetReceived(string id, Object sender, AssetBase asset)
+ {
+ AssetReceivedDelegate callback = (AssetReceivedDelegate)sender;
+
+ callback(asset);
+ }
}
}
--
cgit v1.1