diff options
author | Tedd Hansen | 2008-02-02 00:09:55 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-02-02 00:09:55 +0000 |
commit | 34d21ac94b227e0ab7c089000751e746ccf004a8 (patch) | |
tree | 29ce90cb406c1bc31fe017ad880e32d7172501cb | |
parent | Moved iniFilePath to a static and put it in OpenSim.Application.iniFilePath. (diff) | |
download | opensim-SC_OLD-34d21ac94b227e0ab7c089000751e746ccf004a8.zip opensim-SC_OLD-34d21ac94b227e0ab7c089000751e746ccf004a8.tar.gz opensim-SC_OLD-34d21ac94b227e0ab7c089000751e746ccf004a8.tar.bz2 opensim-SC_OLD-34d21ac94b227e0ab7c089000751e746ccf004a8.tar.xz |
Added some error checking to MaintenanceThread, no-crash (just log) loading of script engines, and support to load multiple script engines
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs | 58 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 27 |
3 files changed, 66 insertions, 33 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) |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 94bacd1..a403855 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -51,11 +51,6 @@ asset_database = "sqlite" | |||
51 | 51 | ||
52 | verbose = true | 52 | verbose = true |
53 | 53 | ||
54 | ; ScriptEngine | ||
55 | script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll | ||
56 | ;Experimental remote ScriptServer plugin: | ||
57 | ;script_engine = OpenSim.Region.ScriptEngine.RemoteServer.dll | ||
58 | |||
59 | 54 | ||
60 | ; if you would like to allow prim to be physical and move by physics with the physical checkbox in the client set this to true. | 55 | ; if you would like to allow prim to be physical and move by physics with the physical checkbox in the client set this to true. |
61 | physical_prim = true | 56 | physical_prim = true |
@@ -115,7 +110,29 @@ shout_distance = 100 | |||
115 | ; make for smoother sun transition at the cost of network | 110 | ; make for smoother sun transition at the cost of network |
116 | ;frame_rate = 100 | 111 | ;frame_rate = 100 |
117 | 112 | ||
113 | |||
114 | ; ## | ||
115 | ; ## ScriptEngine | ||
116 | ; ## | ||
117 | ; These are region modules loaded into each region to provide script support | ||
118 | ; Scripts may be everything from LSL or C# scripts put in prims to whole game systems that controls the whole grid. | ||
119 | ; You can load multiple modules by separating them with ;. | ||
120 | ; | ||
121 | ; Example: | ||
122 | ;script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll;OpenSim.Region.ScriptEngine.RemoteServer.dll | ||
123 | ; | ||
124 | ; This is the current and most stable ScriptEngine: | ||
125 | script_engine = OpenSim.Region.ScriptEngine.DotNetEngine.dll | ||
126 | |||
127 | ;Experimental remote ScriptServer plugin (does not currently work): | ||
128 | ;script_engine = OpenSim.Region.ScriptEngine.RemoteServer.dll | ||
129 | |||
130 | |||
118 | [ScriptEngine.DotNetEngine] | 131 | [ScriptEngine.DotNetEngine] |
132 | ; | ||
133 | ; These settings are specific to DotNetEngine script engine | ||
134 | ; Other script engines based on OpenSim.Region.ScriptEngine.Common.dll will have almost identical settings, but in another section of this config file. | ||
135 | ; | ||
119 | 136 | ||
120 | ; When a script receives an event the event is queued. | 137 | ; When a script receives an event the event is queued. |
121 | ; Any free thread will start executing this event. One script can only have one event executed simultaneously. | 138 | ; Any free thread will start executing this event. One script can only have one event executed simultaneously. |