From b9f602cc77dea1534623b3fd29884323411fa0af Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 11 Nov 2012 21:15:39 +0000 Subject: Prevent datasnapshot from crashing the simulator --- OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/DataSnapshot') diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index 9794549..18aa609 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -72,6 +72,7 @@ namespace OpenSim.Region.DataSnapshot public string m_listener_port = ConfigSettings.DefaultRegionHttpPort.ToString(); public string m_hostname = "127.0.0.1"; private UUID m_Secret = UUID.Random(); + private bool m_servicesNotified = false; //Update timers private int m_period = 20; // in seconds @@ -179,6 +180,23 @@ namespace OpenSim.Region.DataSnapshot } } } + + // Must be done here because on shared modules, PostInitialise() will run + // BEFORE any scenes are registered. There is no "all scenes have been loaded" + // kind of callback because scenes may be created dynamically, so we cannot + // have that info, ever. + if (!m_servicesNotified) + { + //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer + new DataRequestHandler(m_scenes[0], this); + + m_hostname = m_scenes[0].RegionInfo.ExternalHostName; + + if (m_dataServices != "" && m_dataServices != "noservices") + NotifyDataServices(m_dataServices, "online"); + + m_servicesNotified = true; + } } public void RemoveRegion(Scene scene) @@ -214,16 +232,6 @@ namespace OpenSim.Region.DataSnapshot public void PostInitialise() { - if (!m_enabled) - return; - - //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer - new DataRequestHandler(m_scenes[0], this); - - m_hostname = m_scenes[0].RegionInfo.ExternalHostName; - - if (m_dataServices != "" && m_dataServices != "noservices") - NotifyDataServices(m_dataServices, "online"); } public void RegionLoaded(Scene scene) -- cgit v1.1