aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-18 23:35:05 +0100
committerJustin Clark-Casey (justincc)2012-07-18 23:35:05 +0100
commit528004d34988d8d2349f18ff7d78c6dd50ab8b2d (patch)
treecc5d484e9a803415441fce5868b2ba965d9ff737
parentStop the 15 second initial script compile wait if a script is being rezzed on... (diff)
downloadopensim-SC_OLD-528004d34988d8d2349f18ff7d78c6dd50ab8b2d.zip
opensim-SC_OLD-528004d34988d8d2349f18ff7d78c6dd50ab8b2d.tar.gz
opensim-SC_OLD-528004d34988d8d2349f18ff7d78c6dd50ab8b2d.tar.bz2
opensim-SC_OLD-528004d34988d8d2349f18ff7d78c6dd50ab8b2d.tar.xz
Perform other region ready actions even if simulator is configured to leave logins disabled on startup.
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionReadyModule.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs37
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs45
4 files changed, 48 insertions, 47 deletions
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 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28
29using System; 28using System;
29using OpenSim.Framework;
30 30
31namespace OpenSim.Region.Framework.Interfaces 31namespace OpenSim.Region.Framework.Interfaces
32{ 32{
33 public interface IRegionReadyModule 33 public interface IRegionReadyModule
34 { 34 {
35 void OarLoadingAlert(string msg); 35 void OarLoadingAlert(string msg);
36
37 /// <summary>
38 /// Trigger region ready status manually.
39 /// </summary>
40 /// <remarks>
41 /// This should be called by the scene if the IRegionReadyModule has set Scene.LoginLock == true
42 /// </remarks>
43 /// <param name='scene'></param>
44 void TriggerRegionReady(IScene scene);
36 } 45 }
37} 46}
38 47
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
2506 } 2506 }
2507 } 2507 }
2508 } 2508 }
2509 2509
2510 public void TriggerRegionReady(IScene scene) 2510 public void TriggerRegionReady(IScene scene)
2511 { 2511 {
2512 RegionReady handler = OnRegionReady; 2512 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
702 { 702 {
703 IConfig startupConfig = m_config.Configs["Startup"]; 703 IConfig startupConfig = m_config.Configs["Startup"];
704 704
705 StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
706
705 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); 707 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance);
706 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); 708 m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
707 if (!m_useBackup) 709 if (!m_useBackup)
@@ -1484,35 +1486,32 @@ namespace OpenSim.Region.Framework.Scenes
1484 // this is a rare case where we know we have just went through a long cycle of heap 1486 // this is a rare case where we know we have just went through a long cycle of heap
1485 // allocations, and there is no more work to be done until someone logs in 1487 // allocations, and there is no more work to be done until someone logs in
1486 GC.Collect(); 1488 GC.Collect();
1487 1489
1488 IConfig startupConfig = m_config.Configs["Startup"]; 1490 if (!LoginLock)
1489 if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
1490 { 1491 {
1491 if (LoginLock) 1492 if (!StartDisabled)
1492 {
1493 // This handles a case of a region having no scripts for the RegionReady module
1494 if (m_sceneGraph.GetActiveScriptsCount() == 0)
1495 {
1496 // XXX: need to be able to tell these have changed in RegionReady, since it will not
1497 // detect a scenario where the region has no scripts - it's listening to the
1498 // script compile queue.
1499 EventManager.TriggerLoginsEnabled(this);
1500 }
1501 }
1502 else
1503 { 1493 {
1504 m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); 1494 m_log.InfoFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1505 LoginsDisabled = false; 1495 LoginsDisabled = false;
1506 EventManager.TriggerLoginsEnabled(this); 1496 EventManager.TriggerLoginsEnabled(this);
1507 EventManager.TriggerRegionReady(this);
1508 } 1497 }
1509 1498
1510 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); 1499 // Region ready should always be triggered whether logins are immediately enabled or not.
1500 EventManager.TriggerRegionReady(this);
1511 } 1501 }
1512 else 1502 else
1513 { 1503 {
1514 StartDisabled = true; 1504 // This handles a case of a region having no scripts for the RegionReady module
1515 LoginsDisabled = true; 1505 if (m_sceneGraph.GetActiveScriptsCount() == 0)
1506 {
1507 // In this case, we leave it to the IRegionReadyModule to enable logins
1508
1509 // LoginLock can currently only be set by a region module implementation.
1510 // If somehow this hasn't been done then the quickest way to bugfix is to see the
1511 // NullReferenceException
1512 IRegionReadyModule rrm = RequestModuleInterface<IRegionReadyModule>();
1513 rrm.TriggerRegionReady(this);
1514 }
1516 } 1515 }
1517 } 1516 }
1518 } 1517 }
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 6b09c3b..8d5b25f 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -31,16 +31,14 @@ using System.Reflection;
31using System.Net; 31using System.Net;
32using System.IO; 32using System.IO;
33using System.Text; 33using System.Text;
34
35using log4net; 34using log4net;
36using Nini.Config; 35using Nini.Config;
37using OpenMetaverse; 36using OpenMetaverse;
38using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
39using OpenSim.Services.Interfaces;
40
41using OpenSim.Framework; 38using OpenSim.Framework;
42using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces;
44 42
45namespace OpenSim.Region.OptionalModules.Scripting.RegionReady 43namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
46{ 44{
@@ -105,7 +103,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
105 if (m_disable_logins) 103 if (m_disable_logins)
106 { 104 {
107 m_scene.LoginLock = true; 105 m_scene.LoginLock = true;
108 m_scene.EventManager.OnLoginsEnabled += OnLoginsEnabled;
109 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue; 106 m_scene.EventManager.OnEmptyScriptCompileQueue += OnEmptyScriptCompileQueue;
110 107
111 m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name); 108 m_log.InfoFormat("[RegionReady]: Region {0} - LOGINS DISABLED DURING INITIALIZATION.", m_scene.Name);
@@ -125,15 +122,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
125 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; 122 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
126 123
127 if (m_disable_logins) 124 if (m_disable_logins)
128 {
129 m_scene.EventManager.OnLoginsEnabled -= OnLoginsEnabled;
130 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; 125 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
131 }
132 126
133 if (m_uri != string.Empty) 127 if (m_uri != string.Empty)
134 {
135 RRAlert("shutdown"); 128 RRAlert("shutdown");
136 }
137 129
138 m_scene = null; 130 m_scene = null;
139 } 131 }
@@ -186,8 +178,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
186 m_scene.RegionInfo.RegionName, c.Message, m_channelNotify); 178 m_scene.RegionInfo.RegionName, c.Message, m_channelNotify);
187 179
188 m_scene.EventManager.TriggerOnChatBroadcast(this, c); 180 m_scene.EventManager.TriggerOnChatBroadcast(this, c);
189 m_scene.EventManager.TriggerLoginsEnabled(m_scene); 181
190 m_scene.SceneGridService.InformNeighborsThatRegionisUp(m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo); 182 TriggerRegionReady(m_scene);
191 } 183 }
192 } 184 }
193 185
@@ -207,20 +199,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
207 } 199 }
208 200
209 /// <summary> 201 /// <summary>
210 /// This will be triggered by Scene directly if it contains no scripts on startup. 202 /// This will be triggered by Scene directly if it contains no scripts on startup. Otherwise it is triggered
203 /// when the script compile queue is empty after initial region startup.
211 /// </summary> 204 /// </summary>
212 /// <remarks>
213 /// m_ScriptsRezzing will be false if there were none
214 /// else it will be true and we should wait on the
215 /// empty compile queue
216 /// </remarks>
217 /// <param name='scene'></param> 205 /// <param name='scene'></param>
218 void OnLoginsEnabled(IScene scene) 206 public void TriggerRegionReady(IScene scene)
219 { 207 {
220 if (m_scene.StartDisabled == false) 208 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
209 m_scene.LoginLock = false;
210
211 if (!m_scene.StartDisabled)
221 { 212 {
222 m_scene.LoginsDisabled = false; 213 m_scene.LoginsDisabled = false;
223 m_scene.LoginLock = false;
224 214
225 // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}", 215 // m_log.InfoFormat("[RegionReady]: Logins enabled for {0}, Oar {1}",
226 // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString()); 216 // m_scene.RegionInfo.RegionName, m_oarFileLoading.ToString());
@@ -228,15 +218,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
228 m_log.InfoFormat( 218 m_log.InfoFormat(
229 "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name); 219 "[RegionReady]: INITIALIZATION COMPLETE FOR {0} - LOGINS ENABLED", m_scene.Name);
230 220
231 if (m_uri != string.Empty) 221 m_scene.EventManager.TriggerLoginsEnabled(m_scene);
232 { 222 }
233 RRAlert("enabled"); 223
234 } 224 m_scene.SceneGridService.InformNeighborsThatRegionisUp(
225 m_scene.RequestModuleInterface<INeighbourService>(), m_scene.RegionInfo);
235 226
236 m_scene.EventManager.TriggerRegionReady(m_scene); 227 if (m_uri != string.Empty)
228 {
229 RRAlert("enabled");
237 } 230 }
238 231
239 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; 232 m_scene.EventManager.TriggerRegionReady(m_scene);
240 } 233 }
241 234
242 public void OarLoadingAlert(string msg) 235 public void OarLoadingAlert(string msg)