aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTedd Hansen2008-02-02 00:09:55 +0000
committerTedd Hansen2008-02-02 00:09:55 +0000
commit34d21ac94b227e0ab7c089000751e746ccf004a8 (patch)
tree29ce90cb406c1bc31fe017ad880e32d7172501cb /OpenSim
parentMoved iniFilePath to a static and put it in OpenSim.Application.iniFilePath. (diff)
downloadopensim-SC-34d21ac94b227e0ab7c089000751e746ccf004a8.zip
opensim-SC-34d21ac94b227e0ab7c089000751e746ccf004a8.tar.gz
opensim-SC-34d21ac94b227e0ab7c089000751e746ccf004a8.tar.bz2
opensim-SC-34d21ac94b227e0ab7c089000751e746ccf004a8.tar.xz
Added some error checking to MaintenanceThread, no-crash (just log) loading of script engines, and support to load multiple script engines
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs58
2 files changed, 44 insertions, 28 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index ad5a960..7d3f7b8 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -455,7 +455,19 @@ namespace OpenSim
455 //m_moduleLoader.PickupModules(scene, "ScriptEngines"); 455 //m_moduleLoader.PickupModules(scene, "ScriptEngines");
456 //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); 456 //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene);
457 MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules"); 457 MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules");
458 m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); 458 foreach (string module in m_scriptEngine.Split(';'))
459 {
460 string mod = module.Trim(" \t\r\n".ToCharArray()); // Clean up name
461 MainLog.Instance.Verbose("MODULES", "Loading scripting engine: " + mod);
462 try
463 {
464 m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", mod), scene);
465 }
466 catch (Exception ex)
467 {
468 MainLog.Instance.Error("MODULES", "Failed to load script engine: " + ex.ToString());
469 }
470 }
459 471
460 m_moduleLoader.InitialiseSharedModules(scene); 472 m_moduleLoader.InitialiseSharedModules(scene);
461 scene.SetModuleInterfaces(); 473 scene.SetModuleInterfaces();
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
index 105d47f..842bac9 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs
@@ -95,40 +95,44 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
95 System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass 95 System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass
96 if (PleaseShutdown) 96 if (PleaseShutdown)
97 return; 97 return;
98 // 98
99 // Re-reading config every x seconds 99 if (m_ScriptEngine != null)
100 //
101 if (m_ScriptEngine.RefreshConfigFileSeconds > 0)
102 { 100 {
103 // Check if its time to re-read config 101 //
104 if (DateTime.Now.Ticks - Last_ReReadConfigFilens > m_ScriptEngine.RefreshConfigFilens) 102 // Re-reading config every x seconds
103 //
104 if (m_ScriptEngine.RefreshConfigFileSeconds > 0)
105 { 105 {
106 // Its time to re-read config file 106 // Check if its time to re-read config
107 m_ScriptEngine.ConfigSource.Reload(); // Refresh config 107 if (DateTime.Now.Ticks - Last_ReReadConfigFilens > m_ScriptEngine.RefreshConfigFilens)
108 m_ScriptEngine.ReadConfig(); 108 {
109 Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time 109 // Its time to re-read config file
110 m_ScriptEngine.ReadConfig();
111 Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time
112 }
110 } 113 }
111 }
112 114
113 // 115 //
114 // Adjust number of running script threads if not correct 116 // Adjust number of running script threads if not correct
115 // 117 //
116 m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads(); 118 if (m_ScriptEngine.m_EventQueueManager != null)
119 m_ScriptEngine.m_EventQueueManager.AdjustNumberOfScriptThreads();
117 120
118 // 121 //
119 // Check if any script has exceeded its max execution time 122 // Check if any script has exceeded its max execution time
120 // 123 //
121 if (m_ScriptEngine.m_EventQueueManager.EnforceMaxExecutionTime) 124 if (m_ScriptEngine.m_EventQueueManager != null && m_ScriptEngine.m_EventQueueManager.EnforceMaxExecutionTime)
122 {
123 // We are enforcing execution time
124 if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
125 m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens)
126 { 125 {
127 // Its time to check again 126 // We are enforcing execution time
128 m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check 127 if (DateTime.Now.Ticks - Last_maxFunctionExecutionTimens >
129 Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time 128 m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens)
129 {
130 // Its time to check again
131 m_ScriptEngine.m_EventQueueManager.CheckScriptMaxExecTime(); // Do check
132 Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
133 }
130 } 134 }
131 } 135 } // m_ScriptEngine != null
132 } 136 }
133 } 137 }
134 catch (Exception ex) 138 catch (Exception ex)