diff options
Diffstat (limited to '')
19 files changed, 125 insertions, 155 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs index 8511b56..3a38497 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs | |||
@@ -41,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
41 | { | 41 | { |
42 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript | 42 | public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript |
43 | { | 43 | { |
44 | |||
45 | // | 44 | // |
46 | // Included as base for any LSL-script that is compiled. | 45 | // Included as base for any LSL-script that is compiled. |
47 | // Any function added here will be accessible to the LSL script. But it must also be added to "LSL_BuiltIn_Commands_Interface" in "OpenSim.Region.ScriptEngine.Common" class. | 46 | // Any function added here will be accessible to the LSL script. But it must also be added to "LSL_BuiltIn_Commands_Interface" in "OpenSim.Region.ScriptEngine.Common" class. |
@@ -49,6 +48,8 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
49 | // Security note: This script will be running inside an restricted AppDomain. Currently AppDomain is not very restricted. | 48 | // Security note: This script will be running inside an restricted AppDomain. Currently AppDomain is not very restricted. |
50 | // | 49 | // |
51 | 50 | ||
51 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
52 | // Object never expires | 53 | // Object never expires |
53 | public override Object InitializeLifetimeService() | 54 | public override Object InitializeLifetimeService() |
54 | { | 55 | { |
@@ -112,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
112 | { | 113 | { |
113 | m_LSL_Functions = LSL_Functions; | 114 | m_LSL_Functions = LSL_Functions; |
114 | 115 | ||
115 | //MainLog.Instance.Notice(ScriptEngineName, "LSL_BaseClass.Start() called."); | 116 | //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called."); |
116 | 117 | ||
117 | // Get this AppDomain's settings and display some of them. | 118 | // Get this AppDomain's settings and display some of them. |
118 | AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; | 119 | AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation; |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 242bd27..66475c3 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -43,12 +43,13 @@ using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | |||
43 | 43 | ||
44 | namespace OpenSim.Region.ScriptEngine.Common | 44 | namespace OpenSim.Region.ScriptEngine.Common |
45 | { | 45 | { |
46 | |||
47 | /// <summary> | 46 | /// <summary> |
48 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. | 47 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. |
49 | /// </summary> | 48 | /// </summary> |
50 | public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface | 49 | public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface |
51 | { | 50 | { |
51 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
52 | private ASCIIEncoding enc = new ASCIIEncoding(); | 53 | private ASCIIEncoding enc = new ASCIIEncoding(); |
53 | private ScriptEngineBase.ScriptEngine m_ScriptEngine; | 54 | private ScriptEngineBase.ScriptEngine m_ScriptEngine; |
54 | private SceneObjectPart m_host; | 55 | private SceneObjectPart m_host; |
@@ -63,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
63 | m_localID = localID; | 64 | m_localID = localID; |
64 | m_itemID = itemID; | 65 | m_itemID = itemID; |
65 | 66 | ||
66 | //MainLog.Instance.Notice(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); | 67 | //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); |
67 | } | 68 | } |
68 | 69 | ||
69 | private DateTime m_timer = DateTime.Now; | 70 | private DateTime m_timer = DateTime.Now; |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs index 2ed0529..0fb8d75 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | |||
30 | using System; | 29 | using System; |
31 | using System.Collections; | 30 | using System.Collections; |
32 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
@@ -37,7 +36,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
37 | { | 36 | { |
38 | public class AppDomainManager : iScriptEngineFunctionModule | 37 | public class AppDomainManager : iScriptEngineFunctionModule |
39 | { | 38 | { |
40 | |||
41 | // | 39 | // |
42 | // This class does AppDomain handling and loading/unloading of scripts in it. | 40 | // This class does AppDomain handling and loading/unloading of scripts in it. |
43 | // It is instanced in "ScriptEngine" and controlled from "ScriptManager" | 41 | // It is instanced in "ScriptEngine" and controlled from "ScriptManager" |
@@ -48,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
48 | // 4. Unload AppDomain completely when all scripts in it has stopped | 46 | // 4. Unload AppDomain completely when all scripts in it has stopped |
49 | // | 47 | // |
50 | 48 | ||
51 | |||
52 | private int maxScriptsPerAppDomain = 1; | 49 | private int maxScriptsPerAppDomain = 1; |
53 | 50 | ||
54 | /// <summary> | 51 | /// <summary> |
@@ -149,8 +146,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
149 | ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; | 146 | ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; |
150 | 147 | ||
151 | AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); | 148 | AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); |
152 | m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain Loading: " + | 149 | m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain Loading: " + |
153 | AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); | 150 | AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); |
154 | AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); | 151 | AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); |
155 | 152 | ||
156 | // Return the new AppDomain | 153 | // Return the new AppDomain |
@@ -183,7 +180,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
183 | // Unload | 180 | // Unload |
184 | AppDomain.Unload(ads.CurrentAppDomain); | 181 | AppDomain.Unload(ads.CurrentAppDomain); |
185 | #if DEBUG | 182 | #if DEBUG |
186 | m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); | 183 | m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); |
187 | #endif | 184 | #endif |
188 | } | 185 | } |
189 | } | 186 | } |
@@ -191,14 +188,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
191 | } // lock | 188 | } // lock |
192 | } | 189 | } |
193 | 190 | ||
194 | |||
195 | public IScript LoadScript(string FileName) | 191 | public IScript LoadScript(string FileName) |
196 | { | 192 | { |
197 | // Find next available AppDomain to put it in | 193 | // Find next available AppDomain to put it in |
198 | AppDomainStructure FreeAppDomain = GetFreeAppDomain(); | 194 | AppDomainStructure FreeAppDomain = GetFreeAppDomain(); |
199 | 195 | ||
200 | #if DEBUG | 196 | #if DEBUG |
201 | m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Loading into AppDomain: " + FileName); | 197 | m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Loading into AppDomain: " + FileName); |
202 | #endif | 198 | #endif |
203 | IScript mbrt = | 199 | IScript mbrt = |
204 | (IScript) | 200 | (IScript) |
@@ -220,7 +216,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
220 | lock (freeLock) | 216 | lock (freeLock) |
221 | { | 217 | { |
222 | #if DEBUG | 218 | #if DEBUG |
223 | m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Stopping script in AppDomain"); | 219 | m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Stopping script in AppDomain"); |
224 | #endif | 220 | #endif |
225 | // Check if it is current AppDomain | 221 | // Check if it is current AppDomain |
226 | if (currentAD.CurrentAppDomain == ad) | 222 | if (currentAD.CurrentAppDomain == ad) |
@@ -244,6 +240,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
244 | 240 | ||
245 | UnloadAppDomains(); // Outsite lock, has its own GetLock | 241 | UnloadAppDomains(); // Outsite lock, has its own GetLock |
246 | } | 242 | } |
243 | |||
247 | /// <summary> | 244 | /// <summary> |
248 | /// If set to true then threads and stuff should try to make a graceful exit | 245 | /// If set to true then threads and stuff should try to make a graceful exit |
249 | /// </summary> | 246 | /// </summary> |
@@ -253,6 +250,5 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
253 | set { _PleaseShutdown = value; } | 250 | set { _PleaseShutdown = value; } |
254 | } | 251 | } |
255 | private bool _PleaseShutdown = false; | 252 | private bool _PleaseShutdown = false; |
256 | |||
257 | } | 253 | } |
258 | } \ No newline at end of file | 254 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs index fe6dfcd..e99f0a7 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/Common.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | |||
30 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | 29 | namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase |
31 | { | 30 | { |
32 | public static class Common | 31 | public static class Common |
@@ -36,23 +35,23 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
36 | 35 | ||
37 | // This class just contains some static log stuff used for debugging. | 36 | // This class just contains some static log stuff used for debugging. |
38 | 37 | ||
39 | //public delegate void SendToDebugEventDelegate(string Message); | 38 | //public delegate void SendToDebugEventDelegate(string message); |
40 | //public delegate void SendToLogEventDelegate(string Message); | 39 | //public delegate void SendToLogEventDelegate(string message); |
41 | //static public event SendToDebugEventDelegate SendToDebugEvent; | 40 | //static public event SendToDebugEventDelegate SendToDebugEvent; |
42 | //static public event SendToLogEventDelegate SendToLogEvent; | 41 | //static public event SendToLogEventDelegate SendToLogEvent; |
43 | 42 | ||
44 | public static void SendToDebug(string Message) | 43 | public static void SendToDebug(string message) |
45 | { | 44 | { |
46 | //if (Debug == true) | 45 | //if (Debug == true) |
47 | mySE.Log.Verbose(mySE.ScriptEngineName, "Debug: " + Message); | 46 | mySE.Log.Info("[" + mySE.ScriptEngineName + "]: Debug: " + message); |
48 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 47 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + message); |
49 | } | 48 | } |
50 | 49 | ||
51 | public static void SendToLog(string Message) | 50 | public static void SendToLog(string message) |
52 | { | 51 | { |
53 | //if (Debug == true) | 52 | //if (Debug == true) |
54 | mySE.Log.Verbose(mySE.ScriptEngineName, "LOG: " + Message); | 53 | mySE.Log.Info("[" + mySE.ScriptEngineName + "]: LOG: " + message); |
55 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 54 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + message); |
56 | } | 55 | } |
57 | } | 56 | } |
58 | } \ No newline at end of file | 57 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index 678c3d0..1de010a 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs | |||
@@ -39,7 +39,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
39 | [Serializable] | 39 | [Serializable] |
40 | public class EventManager : OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents, iScriptEngineFunctionModule | 40 | public class EventManager : OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents, iScriptEngineFunctionModule |
41 | { | 41 | { |
42 | |||
43 | // | 42 | // |
44 | // Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine". | 43 | // Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine". |
45 | // This class needs a bit of explaining: | 44 | // This class needs a bit of explaining: |
@@ -65,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
65 | // We may not want to do it because someone is controlling us and will deliver events to us | 64 | // We may not want to do it because someone is controlling us and will deliver events to us |
66 | if (performHookUp) | 65 | if (performHookUp) |
67 | { | 66 | { |
68 | myScriptEngine.Log.Verbose(myScriptEngine.ScriptEngineName, "Hooking up to server events"); | 67 | myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events"); |
69 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 68 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
70 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | 69 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; |
71 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | 70 | myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; |
@@ -78,7 +77,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
78 | { | 77 | { |
79 | } | 78 | } |
80 | 79 | ||
81 | |||
82 | public void changed(uint localID, uint change) | 80 | public void changed(uint localID, uint change) |
83 | { | 81 | { |
84 | // Add to queue for all scripts in localID, Object pass change. | 82 | // Add to queue for all scripts in localID, Object pass change. |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index e1b1b6c..5e06fcd 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs | |||
@@ -44,7 +44,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
44 | [Serializable] | 44 | [Serializable] |
45 | public class EventQueueManager : iScriptEngineFunctionModule | 45 | public class EventQueueManager : iScriptEngineFunctionModule |
46 | { | 46 | { |
47 | |||
48 | // | 47 | // |
49 | // Class is instanced in "ScriptEngine" and used by "EventManager" also instanced in "ScriptEngine". | 48 | // Class is instanced in "ScriptEngine" and used by "EventManager" also instanced in "ScriptEngine". |
50 | // | 49 | // |
@@ -256,16 +255,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
256 | 255 | ||
257 | #endregion | 256 | #endregion |
258 | 257 | ||
259 | |||
260 | #region " Start / stop script execution threads (ThreadClasses) " | 258 | #region " Start / stop script execution threads (ThreadClasses) " |
261 | private void StartNewThreadClass() | 259 | private void StartNewThreadClass() |
262 | { | 260 | { |
263 | EventQueueThreadClass eqtc = new EventQueueThreadClass(this); | 261 | EventQueueThreadClass eqtc = new EventQueueThreadClass(this); |
264 | eventQueueThreads.Add(eqtc); | 262 | eventQueueThreads.Add(eqtc); |
265 | staticGlobalEventQueueThreads.Add(eqtc); | 263 | staticGlobalEventQueueThreads.Add(eqtc); |
266 | m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "Started new script execution thread. Current thread count: " + eventQueueThreads.Count); | 264 | m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Started new script execution thread. Current thread count: " + eventQueueThreads.Count); |
267 | |||
268 | } | 265 | } |
266 | |||
269 | private void AbortThreadClass(EventQueueThreadClass threadClass) | 267 | private void AbortThreadClass(EventQueueThreadClass threadClass) |
270 | { | 268 | { |
271 | if (eventQueueThreads.Contains(threadClass)) | 269 | if (eventQueueThreads.Contains(threadClass)) |
@@ -279,10 +277,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
279 | } | 277 | } |
280 | catch (Exception ex) | 278 | catch (Exception ex) |
281 | { | 279 | { |
282 | m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName + ":EventQueueManager", "If you see this, could you please report it to Tedd:"); | 280 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: If you see this, could you please report it to Tedd:"); |
283 | m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName + ":EventQueueManager", "Script thread execution timeout kill ended in exception: " + ex.ToString()); | 281 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: Script thread execution timeout kill ended in exception: " + ex.ToString()); |
284 | } | 282 | } |
285 | m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count); | 283 | m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count); |
286 | } | 284 | } |
287 | #endregion | 285 | #endregion |
288 | 286 | ||
@@ -334,8 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
334 | public void AddToObjectQueue(uint localID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param) | 332 | public void AddToObjectQueue(uint localID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param) |
335 | { | 333 | { |
336 | // Determine all scripts in Object and add to their queue | 334 | // Determine all scripts in Object and add to their queue |
337 | //myScriptEngine.m_logger.Verbose(ScriptEngineName, "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); | 335 | //myScriptEngine.log.Info("[" + ScriptEngineName + "]: EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName); |
338 | |||
339 | 336 | ||
340 | // Do we have any scripts in this object at all? If not, return | 337 | // Do we have any scripts in this object at all? If not, return |
341 | if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false) | 338 | if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false) |
@@ -368,8 +365,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
368 | { | 365 | { |
369 | if (eventQueue.Count >= EventExecutionMaxQueueSize) | 366 | if (eventQueue.Count >= EventExecutionMaxQueueSize) |
370 | { | 367 | { |
371 | m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event."); | 368 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: ERROR: Event execution queue item count is at " + eventQueue.Count + ". Config variable \"EventExecutionMaxQueueSize\" is set to " + EventExecutionMaxQueueSize + ", so ignoring new event."); |
372 | m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); | 369 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); |
373 | return; | 370 | return; |
374 | } | 371 | } |
375 | 372 | ||
@@ -456,6 +453,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
456 | } | 453 | } |
457 | } | 454 | } |
458 | #endregion | 455 | #endregion |
456 | |||
459 | /// <summary> | 457 | /// <summary> |
460 | /// If set to true then threads and stuff should try to make a graceful exit | 458 | /// If set to true then threads and stuff should try to make a graceful exit |
461 | /// </summary> | 459 | /// </summary> |
@@ -465,6 +463,5 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
465 | set { _PleaseShutdown = value; } | 463 | set { _PleaseShutdown = value; } |
466 | } | 464 | } |
467 | private bool _PleaseShutdown = false; | 465 | private bool _PleaseShutdown = false; |
468 | |||
469 | } | 466 | } |
470 | } \ No newline at end of file | 467 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index ee38306..afa1839 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs | |||
@@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
96 | break; | 96 | break; |
97 | default: | 97 | default: |
98 | MyThreadPriority = ThreadPriority.BelowNormal; // Default | 98 | MyThreadPriority = ThreadPriority.BelowNormal; // Default |
99 | eventQueueManager.m_ScriptEngine.Log.Error("ScriptEngineBase", "Unknown priority type \"" + pri + "\" in config file. Defaulting to \"BelowNormal\"."); | 99 | eventQueueManager.m_ScriptEngine.Log.Error("[ScriptEngineBase]: Unknown priority type \"" + pri + "\" in config file. Defaulting to \"BelowNormal\"."); |
100 | break; | 100 | break; |
101 | } | 101 | } |
102 | 102 | ||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
137 | } | 137 | } |
138 | catch (Exception) | 138 | catch (Exception) |
139 | { | 139 | { |
140 | //myScriptEngine.Log.Verbose(ScriptEngineName, "EventQueueManager Exception killing worker thread: " + e.ToString()); | 140 | //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Exception killing worker thread: " + e.ToString()); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } | 143 | } |
@@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
147 | /// </summary> | 147 | /// </summary> |
148 | private void EventQueueThreadLoop() | 148 | private void EventQueueThreadLoop() |
149 | { | 149 | { |
150 | //myScriptEngine.m_logger.Verbose(ScriptEngineName, "EventQueueManager Worker thread spawned"); | 150 | //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread spawned"); |
151 | try | 151 | try |
152 | { | 152 | { |
153 | while (true) | 153 | while (true) |
@@ -196,7 +196,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
196 | else | 196 | else |
197 | { | 197 | { |
198 | // Something in queue, process | 198 | // Something in queue, process |
199 | //myScriptEngine.m_logger.Verbose(ScriptEngineName, "Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName); | 199 | //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName); |
200 | 200 | ||
201 | // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD | 201 | // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD |
202 | lock (eventQueueManager.queueLock) | 202 | lock (eventQueueManager.queueLock) |
@@ -228,12 +228,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
228 | try | 228 | try |
229 | { | 229 | { |
230 | #if DEBUG | 230 | #if DEBUG |
231 | eventQueueManager.m_ScriptEngine.Log.Debug(ScriptEngineName, | 231 | eventQueueManager.m_ScriptEngine.Log.Debug("[" + ScriptEngineName + "]: " + |
232 | "Executing event:\r\n" | 232 | "Executing event:\r\n" |
233 | + "QIS.localID: " + QIS.localID | 233 | + "QIS.localID: " + QIS.localID |
234 | + ", QIS.itemID: " + QIS.itemID | 234 | + ", QIS.itemID: " + QIS.itemID |
235 | + ", QIS.functionName: " + | 235 | + ", QIS.functionName: " + |
236 | QIS.functionName); | 236 | QIS.functionName); |
237 | #endif | 237 | #endif |
238 | LastExecutionStarted = DateTime.Now.Ticks; | 238 | LastExecutionStarted = DateTime.Now.Ticks; |
239 | KillCurrentScript = false; | 239 | KillCurrentScript = false; |
@@ -284,9 +284,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
284 | //else | 284 | //else |
285 | //{ | 285 | //{ |
286 | // T oconsole | 286 | // T oconsole |
287 | eventQueueManager.m_ScriptEngine.Log.Error(ScriptEngineName, | 287 | eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: " + |
288 | "Unable to send text in-world:\r\n" + | 288 | "Unable to send text in-world:\r\n" + |
289 | text); | 289 | text); |
290 | } | 290 | } |
291 | finally | 291 | finally |
292 | { | 292 | { |
@@ -309,17 +309,17 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
309 | } | 309 | } |
310 | catch (ThreadAbortException tae) | 310 | catch (ThreadAbortException tae) |
311 | { | 311 | { |
312 | eventQueueManager.m_ScriptEngine.Log.Notice(ScriptEngineName, "ThreadAbortException while executing function."); | 312 | eventQueueManager.m_ScriptEngine.Log.Info("[" + ScriptEngineName + "]: ThreadAbortException while executing function."); |
313 | } | 313 | } |
314 | catch (Exception e) | 314 | catch (Exception e) |
315 | { | 315 | { |
316 | eventQueueManager.m_ScriptEngine.Log.Error(ScriptEngineName, "Exception in EventQueueThreadLoop: " + e.ToString()); | 316 | eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: Exception in EventQueueThreadLoop: " + e.ToString()); |
317 | } | 317 | } |
318 | } // while | 318 | } // while |
319 | } // try | 319 | } // try |
320 | catch (ThreadAbortException) | 320 | catch (ThreadAbortException) |
321 | { | 321 | { |
322 | //myScriptEngine.Log.Verbose(ScriptEngineName, "EventQueueManager Worker thread killed: " + tae.Message); | 322 | //myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread killed: " + tae.Message); |
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs index 4a119f0..ab4ea04 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs | |||
@@ -87,7 +87,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
87 | private void StopMaintenanceThread() | 87 | private void StopMaintenanceThread() |
88 | { | 88 | { |
89 | #if DEBUG | 89 | #if DEBUG |
90 | m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "StopMaintenanceThread() called"); | 90 | m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called"); |
91 | #endif | 91 | #endif |
92 | PleaseShutdown = true; | 92 | PleaseShutdown = true; |
93 | Thread.Sleep(100); | 93 | Thread.Sleep(100); |
@@ -103,7 +103,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
103 | } | 103 | } |
104 | catch (Exception ex) | 104 | catch (Exception ex) |
105 | { | 105 | { |
106 | m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Exception stopping maintenence thread: " + ex.ToString()); | 106 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception stopping maintenence thread: " + ex.ToString()); |
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
@@ -113,8 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
113 | public void MaintenanceLoop() | 113 | public void MaintenanceLoop() |
114 | { | 114 | { |
115 | if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms) | 115 | if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms) |
116 | m_ScriptEngine.Log.Warn(m_ScriptEngine.ScriptEngineName, | 116 | m_ScriptEngine.Log.Warn("[" + m_ScriptEngine.ScriptEngineName + "]: " + |
117 | "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run."); | 117 | "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run."); |
118 | 118 | ||
119 | long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks; | 119 | long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks; |
120 | long Last_ReReadConfigFilens = DateTime.Now.Ticks; | 120 | long Last_ReReadConfigFilens = DateTime.Now.Ticks; |
@@ -170,7 +170,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
170 | } | 170 | } |
171 | catch (Exception ex) | 171 | catch (Exception ex) |
172 | { | 172 | { |
173 | m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString()); | 173 | m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString()); |
174 | Thread.Sleep(5000); | 174 | Thread.Sleep(5000); |
175 | } | 175 | } |
176 | } | 176 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs index f09e631..78d9f7d 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | |||
30 | using System; | 29 | using System; |
31 | using System.IO; | 30 | using System.IO; |
32 | using Nini.Config; | 31 | using Nini.Config; |
@@ -45,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
45 | [Serializable] | 44 | [Serializable] |
46 | public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule | 45 | public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule |
47 | { | 46 | { |
47 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
48 | public Scene World; | 49 | public Scene World; |
49 | public EventManager m_EventManager; // Handles and queues incoming events from OpenSim | 50 | public EventManager m_EventManager; // Handles and queues incoming events from OpenSim |
50 | public EventQueueManager m_EventQueueManager; // Executes events, handles script threads | 51 | public EventQueueManager m_EventQueueManager; // Executes events, handles script threads |
@@ -73,7 +74,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
73 | 74 | ||
74 | public abstract ScriptManager _GetScriptManager(); | 75 | public abstract ScriptManager _GetScriptManager(); |
75 | 76 | ||
76 | private LogBase m_log; | 77 | public log4net.ILog Log |
78 | { | ||
79 | get { return m_log; } | ||
80 | } | ||
77 | 81 | ||
78 | public ScriptEngine() | 82 | public ScriptEngine() |
79 | { | 83 | { |
@@ -81,25 +85,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
81 | Common.mySE = this; | 85 | Common.mySE = this; |
82 | } | 86 | } |
83 | 87 | ||
84 | public LogBase Log | 88 | public void InitializeEngine(Scene Sceneworld, IConfigSource config, bool HookUpToServer, ScriptManager newScriptManager) |
85 | { | ||
86 | get { return m_log; } | ||
87 | } | ||
88 | |||
89 | public void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager) | ||
90 | { | 89 | { |
91 | World = Sceneworld; | 90 | World = Sceneworld; |
92 | m_log = logger; | ||
93 | ConfigSource = config; | 91 | ConfigSource = config; |
94 | Log.Verbose(ScriptEngineName, "ScriptEngine initializing"); | 92 | m_log.Info("[" + ScriptEngineName + "]: ScriptEngine initializing"); |
95 | 93 | ||
96 | // Make sure we have config | 94 | // Make sure we have config |
97 | if (ConfigSource.Configs[ScriptEngineName] == null) | 95 | if (ConfigSource.Configs[ScriptEngineName] == null) |
98 | ConfigSource.AddConfig(ScriptEngineName); | 96 | ConfigSource.AddConfig(ScriptEngineName); |
99 | ScriptConfigSource = ConfigSource.Configs[ScriptEngineName]; | 97 | ScriptConfigSource = ConfigSource.Configs[ScriptEngineName]; |
100 | 98 | ||
101 | 99 | //m_log.Info("[" + ScriptEngineName + "]: InitializeEngine"); | |
102 | //m_logger.Status(ScriptEngineName, "InitializeEngine"); | ||
103 | 100 | ||
104 | // Create all objects we'll be using | 101 | // Create all objects we'll be using |
105 | m_EventQueueManager = new EventQueueManager(this); | 102 | m_EventQueueManager = new EventQueueManager(this); |
@@ -111,11 +108,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
111 | m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this); | 108 | m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this); |
112 | m_MaintenanceThread = new MaintenanceThread(this); | 109 | m_MaintenanceThread = new MaintenanceThread(this); |
113 | 110 | ||
114 | Log.Verbose(ScriptEngineName, "Reading configuration from config section \"" + ScriptEngineName + "\""); | 111 | m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\""); |
115 | ReadConfig(); | 112 | ReadConfig(); |
116 | 113 | ||
117 | |||
118 | |||
119 | // Should we iterate the region for scripts that needs starting? | 114 | // Should we iterate the region for scripts that needs starting? |
120 | // Or can we assume we are loaded before anything else so we can use proper events? | 115 | // Or can we assume we are loaded before anything else so we can use proper events? |
121 | } | 116 | } |
@@ -129,10 +124,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
129 | { | 124 | { |
130 | return this.m_EventManager; | 125 | return this.m_EventManager; |
131 | } | 126 | } |
127 | |||
132 | public void ReadConfig() | 128 | public void ReadConfig() |
133 | { | 129 | { |
134 | //#if DEBUG | 130 | //#if DEBUG |
135 | // Log.Debug(ScriptEngineName, "Refreshing configuration for all modules"); | 131 | // m_log.Debug("[" + ScriptEngineName + "]: Refreshing configuration for all modules"); |
136 | //#endif | 132 | //#endif |
137 | RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30); | 133 | RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30); |
138 | 134 | ||
@@ -153,10 +149,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
153 | if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig(); | 149 | if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig(); |
154 | if (m_ASYNCLSLCommandManager != null) m_ASYNCLSLCommandManager.ReadConfig(); | 150 | if (m_ASYNCLSLCommandManager != null) m_ASYNCLSLCommandManager.ReadConfig(); |
155 | if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig(); | 151 | if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig(); |
156 | |||
157 | } | 152 | } |
158 | 153 | ||
159 | |||
160 | #region IRegionModule | 154 | #region IRegionModule |
161 | 155 | ||
162 | public abstract void Initialise(Scene scene, IConfigSource config); | 156 | public abstract void Initialise(Scene scene, IConfigSource config); |
@@ -179,8 +173,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
179 | get { return false; } | 173 | get { return false; } |
180 | } | 174 | } |
181 | 175 | ||
182 | |||
183 | |||
184 | #endregion | 176 | #endregion |
185 | 177 | ||
186 | /// <summary> | 178 | /// <summary> |
@@ -194,4 +186,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
194 | private bool _PleaseShutdown = false; | 186 | private bool _PleaseShutdown = false; |
195 | 187 | ||
196 | } | 188 | } |
197 | } \ No newline at end of file | 189 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 6661fcc..12d26fc 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | |||
@@ -249,7 +249,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
249 | { | 249 | { |
250 | if (LUQueue.Count >= LoadUnloadMaxQueueSize) | 250 | if (LUQueue.Count >= LoadUnloadMaxQueueSize) |
251 | { | 251 | { |
252 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "ERROR: Load/unload queue item count is at " + LUQueue.Count + ". Config variable \"LoadUnloadMaxQueueSize\" is set to " + LoadUnloadMaxQueueSize + ", so ignoring new script."); | 252 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: ERROR: Load/unload queue item count is at " + LUQueue.Count + ". Config variable \"LoadUnloadMaxQueueSize\" is set to " + LoadUnloadMaxQueueSize + ", so ignoring new script."); |
253 | return; | 253 | return; |
254 | } | 254 | } |
255 | 255 | ||
@@ -299,7 +299,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
299 | Console.WriteLine("ScriptEngine: Inside ExecuteEvent for event " + FunctionName); | 299 | Console.WriteLine("ScriptEngine: Inside ExecuteEvent for event " + FunctionName); |
300 | #endif | 300 | #endif |
301 | // Execute a function in the script | 301 | // Execute a function in the script |
302 | //m_scriptEngine.Log.Verbose(ScriptEngineName, "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); | 302 | //m_scriptEngine.Log.Info("[" + ScriptEngineName + "]: Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); |
303 | //ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID); | 303 | //ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID); |
304 | IScript Script = GetScript(localID, itemID); | 304 | IScript Script = GetScript(localID, itemID); |
305 | if (Script == null) | 305 | if (Script == null) |
@@ -418,4 +418,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
418 | private bool _PleaseShutdown = false; | 418 | private bool _PleaseShutdown = false; |
419 | 419 | ||
420 | } | 420 | } |
421 | } \ No newline at end of file | 421 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs index 38f7e7b..d5031c8 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptServerInterfaces.cs | |||
@@ -79,12 +79,12 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
79 | { | 79 | { |
80 | RemoteEvents Events(); | 80 | RemoteEvents Events(); |
81 | } | 81 | } |
82 | |||
82 | public interface ScriptEngine | 83 | public interface ScriptEngine |
83 | { | 84 | { |
84 | RemoteEvents EventManager(); | 85 | RemoteEvents EventManager(); |
85 | void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool DontHookUp, ScriptManager newScriptManager); | 86 | void InitializeEngine(Scene Sceneworld, IConfigSource config, bool DontHookUp, ScriptManager newScriptManager); |
86 | ScriptManager GetScriptManager(); | 87 | ScriptManager GetScriptManager(); |
87 | } | 88 | } |
88 | |||
89 | } | 89 | } |
90 | } | 90 | } |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 3451cce..2f985e4 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | |||
@@ -40,7 +40,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
40 | { | 40 | { |
41 | public class Compiler | 41 | public class Compiler |
42 | { | 42 | { |
43 | |||
44 | // * Uses "LSL2Converter" to convert LSL to C# if necessary. | 43 | // * Uses "LSL2Converter" to convert LSL to C# if necessary. |
45 | // * Compiles C#-code into an assembly | 44 | // * Compiles C#-code into an assembly |
46 | // * Returns assembly name ready for AppDomain load. | 45 | // * Returns assembly name ready for AppDomain load. |
@@ -113,7 +112,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
113 | AllowedCompilers.Clear(); | 112 | AllowedCompilers.Clear(); |
114 | 113 | ||
115 | #if DEBUG | 114 | #if DEBUG |
116 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Allowed languages: " + allowComp); | 115 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Allowed languages: " + allowComp); |
117 | #endif | 116 | #endif |
118 | 117 | ||
119 | 118 | ||
@@ -122,18 +121,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
122 | string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); | 121 | string strlan = strl.Trim(" \t".ToCharArray()).ToLower(); |
123 | if (!LanguageMapping.ContainsKey(strlan)) | 122 | if (!LanguageMapping.ContainsKey(strlan)) |
124 | { | 123 | { |
125 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); | 124 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); |
126 | } | 125 | } |
127 | else | 126 | else |
128 | { | 127 | { |
129 | #if DEBUG | 128 | #if DEBUG |
130 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); | 129 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\"."); |
131 | #endif | 130 | #endif |
132 | } | 131 | } |
133 | AllowedCompilers.Add(strlan, true); | 132 | AllowedCompilers.Add(strlan, true); |
134 | } | 133 | } |
135 | if (AllowedCompilers.Count == 0) | 134 | if (AllowedCompilers.Count == 0) |
136 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!"); | 135 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!"); |
137 | 136 | ||
138 | // Default language | 137 | // Default language |
139 | string defaultCompileLanguage = m_scriptEngine.ScriptConfigSource.GetString("DefaultCompileLanguage", "lsl").ToLower(); | 138 | string defaultCompileLanguage = m_scriptEngine.ScriptConfigSource.GetString("DefaultCompileLanguage", "lsl").ToLower(); |
@@ -141,22 +140,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
141 | // Is this language recognized at all? | 140 | // Is this language recognized at all? |
142 | if (!LanguageMapping.ContainsKey(defaultCompileLanguage)) | 141 | if (!LanguageMapping.ContainsKey(defaultCompileLanguage)) |
143 | { | 142 | { |
144 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, | 143 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + |
145 | "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\"."); | 144 | "Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\"."); |
146 | defaultCompileLanguage = "lsl"; | 145 | defaultCompileLanguage = "lsl"; |
147 | } | 146 | } |
148 | 147 | ||
149 | // Is this language in allow-list? | 148 | // Is this language in allow-list? |
150 | if (!AllowedCompilers.ContainsKey(defaultCompileLanguage)) | 149 | if (!AllowedCompilers.ContainsKey(defaultCompileLanguage)) |
151 | { | 150 | { |
152 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, | 151 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + |
153 | "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!"); | 152 | "Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!"); |
154 | } | 153 | } |
155 | else | 154 | else |
156 | { | 155 | { |
157 | #if DEBUG | 156 | #if DEBUG |
158 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, | 157 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: " + |
159 | "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language."); | 158 | "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language."); |
160 | #endif | 159 | #endif |
161 | // LANGUAGE IS IN ALLOW-LIST | 160 | // LANGUAGE IS IN ALLOW-LIST |
162 | DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage]; | 161 | DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage]; |
@@ -181,13 +180,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
181 | } | 180 | } |
182 | catch (Exception ex) | 181 | catch (Exception ex) |
183 | { | 182 | { |
184 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString()); | 183 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString()); |
185 | } | 184 | } |
186 | } | 185 | } |
187 | 186 | ||
188 | foreach (string file in Directory.GetFiles(ScriptEnginesPath)) | 187 | foreach (string file in Directory.GetFiles(ScriptEnginesPath)) |
189 | { | 188 | { |
190 | //m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "FILE FOUND: " + file); | 189 | //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: FILE FOUND: " + file); |
191 | 190 | ||
192 | if (file.ToLower().StartsWith(FilePrefix + "_compiled_") || | 191 | if (file.ToLower().StartsWith(FilePrefix + "_compiled_") || |
193 | file.ToLower().StartsWith(FilePrefix + "_source_")) | 192 | file.ToLower().StartsWith(FilePrefix + "_source_")) |
@@ -198,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
198 | } | 197 | } |
199 | catch (Exception ex) | 198 | catch (Exception ex) |
200 | { | 199 | { |
201 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying delete old script file \"" + file + "\": " + ex.ToString()); | 200 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying delete old script file \"" + file + "\": " + ex.ToString()); |
202 | } | 201 | } |
203 | 202 | ||
204 | } | 203 | } |
@@ -313,7 +312,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
313 | Path.Combine("ScriptEngines", | 312 | Path.Combine("ScriptEngines", |
314 | FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll"); | 313 | FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll"); |
315 | #if DEBUG | 314 | #if DEBUG |
316 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Starting compile of \"" + OutFile + "\"."); | 315 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\"."); |
317 | #endif | 316 | #endif |
318 | try | 317 | try |
319 | { | 318 | { |
@@ -321,7 +320,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
321 | } | 320 | } |
322 | catch (Exception e) | 321 | catch (Exception e) |
323 | { | 322 | { |
324 | //m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); | 323 | //m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); |
325 | throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); | 324 | throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString()); |
326 | } | 325 | } |
327 | //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); | 326 | //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); |
@@ -338,7 +337,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
338 | } | 337 | } |
339 | catch (Exception ex) | 338 | catch (Exception ex) |
340 | { | 339 | { |
341 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString()); | 340 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString()); |
342 | } | 341 | } |
343 | } | 342 | } |
344 | 343 | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index 720f946..514c550 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
40 | public override void Initialise(Scene scene, IConfigSource config) | 40 | public override void Initialise(Scene scene, IConfigSource config) |
41 | { | 41 | { |
42 | ConfigSource = config; | 42 | ConfigSource = config; |
43 | InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager()); | 43 | InitializeEngine(scene, config, true, GetScriptManager()); |
44 | } | 44 | } |
45 | 45 | ||
46 | public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() | 46 | public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() |
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 61da6ef..c39d376 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | |||
29 | using System; | 30 | using System; |
30 | using libsecondlife; | 31 | using libsecondlife; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
@@ -60,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
60 | 61 | ||
61 | public override void _StartScript(uint localID, LLUUID itemID, string Script) | 62 | public override void _StartScript(uint localID, LLUUID itemID, string Script) |
62 | { | 63 | { |
63 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); | 64 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); |
64 | 65 | ||
65 | 66 | ||
66 | //IScriptHost root = host.GetRoot(); | 67 | //IScriptHost root = host.GetRoot(); |
@@ -85,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
85 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); | 86 | CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); |
86 | 87 | ||
87 | #if DEBUG | 88 | #if DEBUG |
88 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); | 89 | m_scriptEngine.Log.Debug(String.Format("[" + m_scriptEngine.ScriptEngineName + "]: Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before)); |
89 | #endif | 90 | #endif |
90 | 91 | ||
91 | CompiledScript.Source = Script; | 92 | CompiledScript.Source = Script; |
@@ -106,7 +107,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
106 | } | 107 | } |
107 | catch (Exception e) | 108 | catch (Exception e) |
108 | { | 109 | { |
109 | //m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString()); | 110 | //m_scriptEngine.Log.Error("[ScriptEngine]: Error compiling script: " + e.ToString()); |
110 | try | 111 | try |
111 | { | 112 | { |
112 | // DISPLAY ERROR INWORLD | 113 | // DISPLAY ERROR INWORLD |
@@ -118,9 +119,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
118 | } | 119 | } |
119 | catch (Exception e2) | 120 | catch (Exception e2) |
120 | { | 121 | { |
121 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Error displaying error in-world: " + e2.ToString()); | 122 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Error displaying error in-world: " + e2.ToString()); |
122 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, | 123 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " + |
123 | "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); | 124 | "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); |
124 | } | 125 | } |
125 | } | 126 | } |
126 | } | 127 | } |
@@ -129,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
129 | { | 130 | { |
130 | // Stop script | 131 | // Stop script |
131 | #if DEBUG | 132 | #if DEBUG |
132 | m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Stop script localID: " + localID + " LLUID: " + itemID.ToString()); | 133 | m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Stop script localID: " + localID + " LLUID: " + itemID.ToString()); |
133 | #endif | 134 | #endif |
134 | 135 | ||
135 | // Stop long command on script | 136 | // Stop long command on script |
@@ -142,7 +143,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
142 | // TEMP: First serialize it | 143 | // TEMP: First serialize it |
143 | //GetSerializedScript(localID, itemID); | 144 | //GetSerializedScript(localID, itemID); |
144 | 145 | ||
145 | |||
146 | try | 146 | try |
147 | { | 147 | { |
148 | // Get AppDomain | 148 | // Get AppDomain |
@@ -156,10 +156,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
156 | } | 156 | } |
157 | catch (Exception e) | 157 | catch (Exception e) |
158 | { | 158 | { |
159 | m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + | 159 | m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + |
160 | ": " + e.ToString()); | 160 | ": " + e.ToString()); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | |||
164 | } | 163 | } |
165 | } \ No newline at end of file | 164 | } |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs index 45dfd9e..2a846a9 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptEngine.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine | |||
44 | // We need to override a few things for our DotNetEngine | 44 | // We need to override a few things for our DotNetEngine |
45 | public override void Initialise(Scene scene, IConfigSource config) | 45 | public override void Initialise(Scene scene, IConfigSource config) |
46 | { | 46 | { |
47 | InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager()); | 47 | InitializeEngine(scene, config, true, GetScriptManager()); |
48 | } | 48 | } |
49 | 49 | ||
50 | public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() | 50 | public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() |
diff --git a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs index 652c24c..db81487 100644 --- a/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/LSOEngine/ScriptManager.cs | |||
@@ -101,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine | |||
101 | } | 101 | } |
102 | catch (Exception e) | 102 | catch (Exception e) |
103 | { | 103 | { |
104 | //m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString()); | 104 | //m_scriptEngine.Log.Error("[ScriptEngine]: Error compiling script: " + e.ToString()); |
105 | try | 105 | try |
106 | { | 106 | { |
107 | // DISPLAY ERROR INWORLD | 107 | // DISPLAY ERROR INWORLD |
@@ -113,9 +113,9 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine | |||
113 | } | 113 | } |
114 | catch (Exception e2) | 114 | catch (Exception e2) |
115 | { | 115 | { |
116 | m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); | 116 | m_scriptEngine.Log.Error("[ScriptEngine]: Error displaying error in-world: " + e2.ToString()); |
117 | m_scriptEngine.Log.Error("ScriptEngine", | 117 | m_scriptEngine.Log.Error("[ScriptEngine]: " + |
118 | "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); | 118 | "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
@@ -125,7 +125,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine | |||
125 | // Stop script | 125 | // Stop script |
126 | Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); | 126 | Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); |
127 | 127 | ||
128 | |||
129 | // Stop long command on script | 128 | // Stop long command on script |
130 | m_scriptEngine.m_ASYNCLSLCommandManager.RemoveScript(localID, itemID); | 129 | m_scriptEngine.m_ASYNCLSLCommandManager.RemoveScript(localID, itemID); |
131 | 130 | ||
@@ -136,7 +135,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine | |||
136 | // TEMP: First serialize it | 135 | // TEMP: First serialize it |
137 | //GetSerializedScript(localID, itemID); | 136 | //GetSerializedScript(localID, itemID); |
138 | 137 | ||
139 | |||
140 | try | 138 | try |
141 | { | 139 | { |
142 | // Get AppDomain | 140 | // Get AppDomain |
@@ -157,7 +155,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine | |||
157 | 155 | ||
158 | public override void Initialize() | 156 | public override void Initialize() |
159 | { | 157 | { |
160 | |||
161 | } | 158 | } |
162 | } | 159 | } |
163 | } \ No newline at end of file | 160 | } |
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs index bac32cb..e65b8ff 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/Common.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | |||
29 | namespace OpenSim.Region.ScriptEngine.RemoteServer | 30 | namespace OpenSim.Region.ScriptEngine.RemoteServer |
30 | { | 31 | { |
31 | public static class Common | 32 | public static class Common |
@@ -43,15 +44,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
43 | public static void SendToDebug(string Message) | 44 | public static void SendToDebug(string Message) |
44 | { | 45 | { |
45 | //if (Debug == true) | 46 | //if (Debug == true) |
46 | mySE.Log.Verbose("ScriptEngine", "Debug: " + Message); | 47 | mySE.Log.Info("[ScriptEngine]: Debug: " + Message); |
47 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 48 | //SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
48 | } | 49 | } |
49 | 50 | ||
50 | public static void SendToLog(string Message) | 51 | public static void SendToLog(string Message) |
51 | { | 52 | { |
52 | //if (Debug == true) | 53 | //if (Debug == true) |
53 | mySE.Log.Verbose("ScriptEngine", "LOG: " + Message); | 54 | mySE.Log.Info("[ScriptEngine]: LOG: " + Message); |
54 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); | 55 | //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); |
55 | } | 56 | } |
56 | } | 57 | } |
57 | } \ No newline at end of file | 58 | } |
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs index 047ff2e..971982c 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/EventManager.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | |||
29 | using System; | 30 | using System; |
30 | using libsecondlife; | 31 | using libsecondlife; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
@@ -40,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
40 | [Serializable] | 41 | [Serializable] |
41 | internal class EventManager | 42 | internal class EventManager |
42 | { | 43 | { |
43 | |||
44 | System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject>(); | 44 | System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject>(); |
45 | TCPClient m_TCPClient; | 45 | TCPClient m_TCPClient; |
46 | TRPC_Remote RPC; | 46 | TRPC_Remote RPC; |
@@ -59,32 +59,28 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
59 | RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); | 59 | RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand); |
60 | myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort); | 60 | myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort); |
61 | 61 | ||
62 | myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events"); | 62 | myScriptEngine.Log.Info("[RemoteEngine]: Hooking up to server events"); |
63 | //myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 63 | //myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
64 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; | 64 | myScriptEngine.World.EventManager.OnRezScript += OnRezScript; |
65 | //myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; | 65 | //myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; |
66 | |||
67 | |||
68 | } | 66 | } |
69 | 67 | ||
70 | void RPC_ReceiveCommand(int ID, string Command, params object[] p) | 68 | void RPC_ReceiveCommand(int ID, string Command, params object[] p) |
71 | { | 69 | { |
72 | myScriptEngine.Log.Notice("REMOTESERVER", "Received command: '" + Command + "'"); | 70 | myScriptEngine.Log.Info("[REMOTESERVER]: Received command: '" + Command + "'"); |
73 | if (p != null) | 71 | if (p != null) |
74 | { | 72 | { |
75 | for (int i = 0; i < p.Length; i++) | 73 | for (int i = 0; i < p.Length; i++) |
76 | { | 74 | { |
77 | myScriptEngine.Log.Notice("REMOTESERVER", "Param " + i + ": " + p[i].ToString()); | 75 | myScriptEngine.Log.Info("[REMOTESERVER]: Param " + i + ": " + p[i].ToString()); |
78 | } | 76 | } |
79 | } | 77 | } |
80 | |||
81 | } | 78 | } |
82 | 79 | ||
83 | |||
84 | public void OnRezScript(uint localID, LLUUID itemID, string script) | 80 | public void OnRezScript(uint localID, LLUUID itemID, string script) |
85 | { | 81 | { |
86 | // WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID | 82 | // WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID |
87 | myScriptEngine.Log.Verbose("RemoteEngine", "Creating new script (with connection)"); | 83 | myScriptEngine.Log.Info("[RemoteEngine]: Creating new script (with connection)"); |
88 | 84 | ||
89 | // Temp for now: We have one connection only - this is hardcoded in myScriptServerID | 85 | // Temp for now: We have one connection only - this is hardcoded in myScriptServerID |
90 | RPC.SendCommand(myScriptServerID, "OnRezScript", localID, itemID.ToString(), script); | 86 | RPC.SendCommand(myScriptServerID, "OnRezScript", localID, itemID.ToString(), script); |
@@ -92,18 +88,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
92 | //ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234); | 88 | //ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234); |
93 | //remoteScript.Add(localID, obj); | 89 | //remoteScript.Add(localID, obj); |
94 | //remoteScript[localID].Events().OnRezScript(localID, itemID, script); | 90 | //remoteScript[localID].Events().OnRezScript(localID, itemID, script); |
95 | |||
96 | |||
97 | } | 91 | } |
98 | 92 | ||
99 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 93 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
100 | { | 94 | { |
101 | //remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient); | 95 | //remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient); |
102 | RPC.SendCommand(myScriptServerID, "touch_start", offsetPos, "How to transfer IClientAPI?"); | 96 | RPC.SendCommand(myScriptServerID, "touch_start", offsetPos, "How to transfer IClientAPI?"); |
103 | } | 97 | } |
104 | 98 | ||
105 | 99 | ||
106 | |||
107 | // PLACEHOLDERS -- CODE WILL CHANGE! | 100 | // PLACEHOLDERS -- CODE WILL CHANGE! |
108 | 101 | ||
109 | 102 | ||
@@ -266,6 +259,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
266 | //{ | 259 | //{ |
267 | // remoteScript[localID].Events.http_response(localID, itemID); | 260 | // remoteScript[localID].Events.http_response(localID, itemID); |
268 | //} | 261 | //} |
269 | |||
270 | } | 262 | } |
271 | } \ No newline at end of file | 263 | } |
diff --git a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs index d0dc7ab..8d27251 100644 --- a/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/RemoteServer/ScriptEngine.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | /* Original code: Tedd Hansen */ | 28 | /* Original code: Tedd Hansen */ |
29 | |||
29 | using System; | 30 | using System; |
30 | using Nini.Config; | 31 | using Nini.Config; |
31 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
@@ -41,28 +42,27 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
41 | [Serializable] | 42 | [Serializable] |
42 | public class ScriptEngine : IRegionModule | 43 | public class ScriptEngine : IRegionModule |
43 | { | 44 | { |
45 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
44 | internal Scene World; | 47 | internal Scene World; |
45 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim | 48 | internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim |
46 | internal RemoteServer m_RemoteServer; // Handles connections to remote servers | 49 | internal RemoteServer m_RemoteServer; // Handles connections to remote servers |
47 | 50 | ||
48 | private LogBase m_log; | ||
49 | |||
50 | public ScriptEngine() | 51 | public ScriptEngine() |
51 | { | 52 | { |
52 | Common.mySE = this; | 53 | Common.mySE = this; |
53 | } | 54 | } |
54 | 55 | ||
55 | public LogBase Log | 56 | public log4net.ILog Log |
56 | { | 57 | { |
57 | get { return m_log; } | 58 | get { return m_log; } |
58 | } | 59 | } |
59 | 60 | ||
60 | public void InitializeEngine(Scene Sceneworld, LogBase logger) | 61 | public void InitializeEngine(Scene Sceneworld) |
61 | { | 62 | { |
62 | World = Sceneworld; | 63 | World = Sceneworld; |
63 | m_log = logger; | ||
64 | 64 | ||
65 | Log.Verbose("ScriptEngine", "RemoteEngine (Remote Script Server) initializing"); | 65 | m_log.Info("[ScriptEngine]: RemoteEngine (Remote Script Server) initializing"); |
66 | // Create all objects we'll be using | 66 | // Create all objects we'll be using |
67 | m_EventManager = new EventManager(this); | 67 | m_EventManager = new EventManager(this); |
68 | m_RemoteServer = new RemoteServer(); | 68 | m_RemoteServer = new RemoteServer(); |
@@ -74,12 +74,11 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
74 | // We are shutting down | 74 | // We are shutting down |
75 | } | 75 | } |
76 | 76 | ||
77 | |||
78 | #region IRegionModule | 77 | #region IRegionModule |
79 | 78 | ||
80 | public void Initialise(Scene scene, IConfigSource config) | 79 | public void Initialise(Scene scene, IConfigSource config) |
81 | { | 80 | { |
82 | InitializeEngine(scene, MainLog.Instance); | 81 | InitializeEngine(scene); |
83 | } | 82 | } |
84 | 83 | ||
85 | public void PostInitialise() | 84 | public void PostInitialise() |
@@ -101,6 +100,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer | |||
101 | } | 100 | } |
102 | 101 | ||
103 | #endregion | 102 | #endregion |
104 | |||
105 | } | 103 | } |
106 | } \ No newline at end of file | 104 | } |