mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O. This is mostly an in-place conversion, so lots of refactoring can still be done.
This commit is contained in:
@@ -41,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript
|
||||
{
|
||||
|
||||
//
|
||||
// Included as base for any LSL-script that is compiled.
|
||||
// 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
|
||||
// Security note: This script will be running inside an restricted AppDomain. Currently AppDomain is not very restricted.
|
||||
//
|
||||
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// Object never expires
|
||||
public override Object InitializeLifetimeService()
|
||||
{
|
||||
@@ -112,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
m_LSL_Functions = LSL_Functions;
|
||||
|
||||
//MainLog.Instance.Notice(ScriptEngineName, "LSL_BaseClass.Start() called.");
|
||||
//m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called.");
|
||||
|
||||
// Get this AppDomain's settings and display some of them.
|
||||
AppDomainSetup ads = AppDomain.CurrentDomain.SetupInformation;
|
||||
|
||||
@@ -43,12 +43,13 @@ using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Contains all LSL ll-functions. This class will be in Default AppDomain.
|
||||
/// </summary>
|
||||
public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface
|
||||
{
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private ASCIIEncoding enc = new ASCIIEncoding();
|
||||
private ScriptEngineBase.ScriptEngine m_ScriptEngine;
|
||||
private SceneObjectPart m_host;
|
||||
@@ -63,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
m_localID = localID;
|
||||
m_itemID = itemID;
|
||||
|
||||
//MainLog.Instance.Notice(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
|
||||
//m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
|
||||
}
|
||||
|
||||
private DateTime m_timer = DateTime.Now;
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -37,7 +36,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
{
|
||||
public class AppDomainManager : iScriptEngineFunctionModule
|
||||
{
|
||||
|
||||
//
|
||||
// This class does AppDomain handling and loading/unloading of scripts in it.
|
||||
// It is instanced in "ScriptEngine" and controlled from "ScriptManager"
|
||||
@@ -48,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
// 4. Unload AppDomain completely when all scripts in it has stopped
|
||||
//
|
||||
|
||||
|
||||
private int maxScriptsPerAppDomain = 1;
|
||||
|
||||
/// <summary>
|
||||
@@ -149,8 +146,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
|
||||
|
||||
AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads);
|
||||
m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain Loading: " +
|
||||
AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString());
|
||||
m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain Loading: " +
|
||||
AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString());
|
||||
AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll"));
|
||||
|
||||
// Return the new AppDomain
|
||||
@@ -183,7 +180,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
// Unload
|
||||
AppDomain.Unload(ads.CurrentAppDomain);
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory");
|
||||
m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -191,14 +188,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
} // lock
|
||||
}
|
||||
|
||||
|
||||
public IScript LoadScript(string FileName)
|
||||
{
|
||||
// Find next available AppDomain to put it in
|
||||
AppDomainStructure FreeAppDomain = GetFreeAppDomain();
|
||||
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Loading into AppDomain: " + FileName);
|
||||
m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Loading into AppDomain: " + FileName);
|
||||
#endif
|
||||
IScript mbrt =
|
||||
(IScript)
|
||||
@@ -220,7 +216,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
lock (freeLock)
|
||||
{
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Stopping script in AppDomain");
|
||||
m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Stopping script in AppDomain");
|
||||
#endif
|
||||
// Check if it is current AppDomain
|
||||
if (currentAD.CurrentAppDomain == ad)
|
||||
@@ -244,6 +240,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
|
||||
UnloadAppDomains(); // Outsite lock, has its own GetLock
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If set to true then threads and stuff should try to make a graceful exit
|
||||
/// </summary>
|
||||
@@ -253,6 +250,5 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
set { _PleaseShutdown = value; }
|
||||
}
|
||||
private bool _PleaseShutdown = false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
{
|
||||
public static class Common
|
||||
@@ -36,23 +35,23 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
|
||||
// This class just contains some static log stuff used for debugging.
|
||||
|
||||
//public delegate void SendToDebugEventDelegate(string Message);
|
||||
//public delegate void SendToLogEventDelegate(string Message);
|
||||
//public delegate void SendToDebugEventDelegate(string message);
|
||||
//public delegate void SendToLogEventDelegate(string message);
|
||||
//static public event SendToDebugEventDelegate SendToDebugEvent;
|
||||
//static public event SendToLogEventDelegate SendToLogEvent;
|
||||
|
||||
public static void SendToDebug(string Message)
|
||||
public static void SendToDebug(string message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
mySE.Log.Verbose(mySE.ScriptEngineName, "Debug: " + Message);
|
||||
//SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
mySE.Log.Info("[" + mySE.ScriptEngineName + "]: Debug: " + message);
|
||||
//SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + message);
|
||||
}
|
||||
|
||||
public static void SendToLog(string Message)
|
||||
public static void SendToLog(string message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
mySE.Log.Verbose(mySE.ScriptEngineName, "LOG: " + Message);
|
||||
//SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
mySE.Log.Info("[" + mySE.ScriptEngineName + "]: LOG: " + message);
|
||||
//SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
[Serializable]
|
||||
public class EventManager : OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.RemoteEvents, iScriptEngineFunctionModule
|
||||
{
|
||||
|
||||
//
|
||||
// Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine".
|
||||
// This class needs a bit of explaining:
|
||||
@@ -65,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
// We may not want to do it because someone is controlling us and will deliver events to us
|
||||
if (performHookUp)
|
||||
{
|
||||
myScriptEngine.Log.Verbose(myScriptEngine.ScriptEngineName, "Hooking up to server events");
|
||||
myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events");
|
||||
myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
|
||||
myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
|
||||
myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
|
||||
@@ -78,7 +77,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void changed(uint localID, uint change)
|
||||
{
|
||||
// Add to queue for all scripts in localID, Object pass change.
|
||||
|
||||
@@ -44,7 +44,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
[Serializable]
|
||||
public class EventQueueManager : iScriptEngineFunctionModule
|
||||
{
|
||||
|
||||
//
|
||||
// Class is instanced in "ScriptEngine" and used by "EventManager" also instanced in "ScriptEngine".
|
||||
//
|
||||
@@ -256,16 +255,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region " Start / stop script execution threads (ThreadClasses) "
|
||||
private void StartNewThreadClass()
|
||||
{
|
||||
EventQueueThreadClass eqtc = new EventQueueThreadClass(this);
|
||||
eventQueueThreads.Add(eqtc);
|
||||
staticGlobalEventQueueThreads.Add(eqtc);
|
||||
m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "Started new script execution thread. Current thread count: " + eventQueueThreads.Count);
|
||||
|
||||
m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Started new script execution thread. Current thread count: " + eventQueueThreads.Count);
|
||||
}
|
||||
|
||||
private void AbortThreadClass(EventQueueThreadClass threadClass)
|
||||
{
|
||||
if (eventQueueThreads.Contains(threadClass))
|
||||
@@ -279,10 +277,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName + ":EventQueueManager", "If you see this, could you please report it to Tedd:");
|
||||
m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName + ":EventQueueManager", "Script thread execution timeout kill ended in exception: " + ex.ToString());
|
||||
m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: If you see this, could you please report it to Tedd:");
|
||||
m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + ":EventQueueManager]: Script thread execution timeout kill ended in exception: " + ex.ToString());
|
||||
}
|
||||
m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count);
|
||||
m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: Killed script execution thread. Remaining thread count: " + eventQueueThreads.Count);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -334,8 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
public void AddToObjectQueue(uint localID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param)
|
||||
{
|
||||
// Determine all scripts in Object and add to their queue
|
||||
//myScriptEngine.m_logger.Verbose(ScriptEngineName, "EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName);
|
||||
|
||||
//myScriptEngine.log.Info("[" + ScriptEngineName + "]: EventQueueManager Adding localID: " + localID + ", FunctionName: " + FunctionName);
|
||||
|
||||
// Do we have any scripts in this object at all? If not, return
|
||||
if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false)
|
||||
@@ -368,8 +365,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
{
|
||||
if (eventQueue.Count >= EventExecutionMaxQueueSize)
|
||||
{
|
||||
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.");
|
||||
m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
|
||||
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.");
|
||||
m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Event ignored: localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -456,6 +453,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// If set to true then threads and stuff should try to make a graceful exit
|
||||
/// </summary>
|
||||
@@ -465,6 +463,5 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
set { _PleaseShutdown = value; }
|
||||
}
|
||||
private bool _PleaseShutdown = false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
break;
|
||||
default:
|
||||
MyThreadPriority = ThreadPriority.BelowNormal; // Default
|
||||
eventQueueManager.m_ScriptEngine.Log.Error("ScriptEngineBase", "Unknown priority type \"" + pri + "\" in config file. Defaulting to \"BelowNormal\".");
|
||||
eventQueueManager.m_ScriptEngine.Log.Error("[ScriptEngineBase]: Unknown priority type \"" + pri + "\" in config file. Defaulting to \"BelowNormal\".");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//myScriptEngine.Log.Verbose(ScriptEngineName, "EventQueueManager Exception killing worker thread: " + e.ToString());
|
||||
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Exception killing worker thread: " + e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
/// </summary>
|
||||
private void EventQueueThreadLoop()
|
||||
{
|
||||
//myScriptEngine.m_logger.Verbose(ScriptEngineName, "EventQueueManager Worker thread spawned");
|
||||
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread spawned");
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
@@ -196,7 +196,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
else
|
||||
{
|
||||
// Something in queue, process
|
||||
//myScriptEngine.m_logger.Verbose(ScriptEngineName, "Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName);
|
||||
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName);
|
||||
|
||||
// OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD
|
||||
lock (eventQueueManager.queueLock)
|
||||
@@ -228,12 +228,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
try
|
||||
{
|
||||
#if DEBUG
|
||||
eventQueueManager.m_ScriptEngine.Log.Debug(ScriptEngineName,
|
||||
"Executing event:\r\n"
|
||||
+ "QIS.localID: " + QIS.localID
|
||||
+ ", QIS.itemID: " + QIS.itemID
|
||||
+ ", QIS.functionName: " +
|
||||
QIS.functionName);
|
||||
eventQueueManager.m_ScriptEngine.Log.Debug("[" + ScriptEngineName + "]: " +
|
||||
"Executing event:\r\n"
|
||||
+ "QIS.localID: " + QIS.localID
|
||||
+ ", QIS.itemID: " + QIS.itemID
|
||||
+ ", QIS.functionName: " +
|
||||
QIS.functionName);
|
||||
#endif
|
||||
LastExecutionStarted = DateTime.Now.Ticks;
|
||||
KillCurrentScript = false;
|
||||
@@ -284,9 +284,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
//else
|
||||
//{
|
||||
// T oconsole
|
||||
eventQueueManager.m_ScriptEngine.Log.Error(ScriptEngineName,
|
||||
"Unable to send text in-world:\r\n" +
|
||||
text);
|
||||
eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: " +
|
||||
"Unable to send text in-world:\r\n" +
|
||||
text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -309,17 +309,17 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
}
|
||||
catch (ThreadAbortException tae)
|
||||
{
|
||||
eventQueueManager.m_ScriptEngine.Log.Notice(ScriptEngineName, "ThreadAbortException while executing function.");
|
||||
eventQueueManager.m_ScriptEngine.Log.Info("[" + ScriptEngineName + "]: ThreadAbortException while executing function.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
eventQueueManager.m_ScriptEngine.Log.Error(ScriptEngineName, "Exception in EventQueueThreadLoop: " + e.ToString());
|
||||
eventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName + "]: Exception in EventQueueThreadLoop: " + e.ToString());
|
||||
}
|
||||
} // while
|
||||
} // try
|
||||
catch (ThreadAbortException)
|
||||
{
|
||||
//myScriptEngine.Log.Verbose(ScriptEngineName, "EventQueueManager Worker thread killed: " + tae.Message);
|
||||
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread killed: " + tae.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
private void StopMaintenanceThread()
|
||||
{
|
||||
#if DEBUG
|
||||
m_ScriptEngine.Log.Debug(m_ScriptEngine.ScriptEngineName, "StopMaintenanceThread() called");
|
||||
m_ScriptEngine.Log.Debug("[" + m_ScriptEngine.ScriptEngineName + "]: StopMaintenanceThread() called");
|
||||
#endif
|
||||
PleaseShutdown = true;
|
||||
Thread.Sleep(100);
|
||||
@@ -103,7 +103,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Exception stopping maintenence thread: " + ex.ToString());
|
||||
m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception stopping maintenence thread: " + ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,8 +113,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
public void MaintenanceLoop()
|
||||
{
|
||||
if (m_ScriptEngine.m_EventQueueManager.maxFunctionExecutionTimens < MaintenanceLoopms)
|
||||
m_ScriptEngine.Log.Warn(m_ScriptEngine.ScriptEngineName,
|
||||
"Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run.");
|
||||
m_ScriptEngine.Log.Warn("[" + m_ScriptEngine.ScriptEngineName + "]: " +
|
||||
"Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run.");
|
||||
|
||||
long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks;
|
||||
long Last_ReReadConfigFilens = DateTime.Now.Ticks;
|
||||
@@ -170,7 +170,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_ScriptEngine.Log.Error(m_ScriptEngine.ScriptEngineName, "Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString());
|
||||
m_ScriptEngine.Log.Error("[" + m_ScriptEngine.ScriptEngineName + "]: Exception in MaintenanceLoopThread. Thread will recover after 5 sec throttle. Exception: " + ex.ToString());
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Nini.Config;
|
||||
@@ -45,6 +44,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
[Serializable]
|
||||
public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule
|
||||
{
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public Scene World;
|
||||
public EventManager m_EventManager; // Handles and queues incoming events from OpenSim
|
||||
public EventQueueManager m_EventQueueManager; // Executes events, handles script threads
|
||||
@@ -73,7 +74,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
|
||||
public abstract ScriptManager _GetScriptManager();
|
||||
|
||||
private LogBase m_log;
|
||||
public log4net.ILog Log
|
||||
{
|
||||
get { return m_log; }
|
||||
}
|
||||
|
||||
public ScriptEngine()
|
||||
{
|
||||
@@ -81,25 +85,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
Common.mySE = this;
|
||||
}
|
||||
|
||||
public LogBase Log
|
||||
{
|
||||
get { return m_log; }
|
||||
}
|
||||
|
||||
public void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager)
|
||||
public void InitializeEngine(Scene Sceneworld, IConfigSource config, bool HookUpToServer, ScriptManager newScriptManager)
|
||||
{
|
||||
World = Sceneworld;
|
||||
m_log = logger;
|
||||
ConfigSource = config;
|
||||
Log.Verbose(ScriptEngineName, "ScriptEngine initializing");
|
||||
m_log.Info("[" + ScriptEngineName + "]: ScriptEngine initializing");
|
||||
|
||||
// Make sure we have config
|
||||
if (ConfigSource.Configs[ScriptEngineName] == null)
|
||||
ConfigSource.AddConfig(ScriptEngineName);
|
||||
ScriptConfigSource = ConfigSource.Configs[ScriptEngineName];
|
||||
|
||||
|
||||
//m_logger.Status(ScriptEngineName, "InitializeEngine");
|
||||
//m_log.Info("[" + ScriptEngineName + "]: InitializeEngine");
|
||||
|
||||
// Create all objects we'll be using
|
||||
m_EventQueueManager = new EventQueueManager(this);
|
||||
@@ -111,11 +108,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this);
|
||||
m_MaintenanceThread = new MaintenanceThread(this);
|
||||
|
||||
Log.Verbose(ScriptEngineName, "Reading configuration from config section \"" + ScriptEngineName + "\"");
|
||||
m_log.Info("[" + ScriptEngineName + "]: Reading configuration from config section \"" + ScriptEngineName + "\"");
|
||||
ReadConfig();
|
||||
|
||||
|
||||
|
||||
// Should we iterate the region for scripts that needs starting?
|
||||
// Or can we assume we are loaded before anything else so we can use proper events?
|
||||
}
|
||||
@@ -129,10 +124,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
{
|
||||
return this.m_EventManager;
|
||||
}
|
||||
|
||||
public void ReadConfig()
|
||||
{
|
||||
//#if DEBUG
|
||||
// Log.Debug(ScriptEngineName, "Refreshing configuration for all modules");
|
||||
// m_log.Debug("[" + ScriptEngineName + "]: Refreshing configuration for all modules");
|
||||
//#endif
|
||||
RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30);
|
||||
|
||||
@@ -153,10 +149,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig();
|
||||
if (m_ASYNCLSLCommandManager != null) m_ASYNCLSLCommandManager.ReadConfig();
|
||||
if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig();
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region IRegionModule
|
||||
|
||||
public abstract void Initialise(Scene scene, IConfigSource config);
|
||||
@@ -179,8 +173,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
@@ -194,4 +186,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
private bool _PleaseShutdown = false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
{
|
||||
if (LUQueue.Count >= LoadUnloadMaxQueueSize)
|
||||
{
|
||||
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.");
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
Console.WriteLine("ScriptEngine: Inside ExecuteEvent for event " + FunctionName);
|
||||
#endif
|
||||
// Execute a function in the script
|
||||
//m_scriptEngine.Log.Verbose(ScriptEngineName, "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
|
||||
//m_scriptEngine.Log.Info("[" + ScriptEngineName + "]: Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
|
||||
//ScriptBaseInterface Script = (ScriptBaseInterface)GetScript(localID, itemID);
|
||||
IScript Script = GetScript(localID, itemID);
|
||||
if (Script == null)
|
||||
@@ -418,4 +418,4 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||
private bool _PleaseShutdown = false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
RemoteEvents Events();
|
||||
}
|
||||
|
||||
public interface ScriptEngine
|
||||
{
|
||||
RemoteEvents EventManager();
|
||||
void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool DontHookUp, ScriptManager newScriptManager);
|
||||
void InitializeEngine(Scene Sceneworld, IConfigSource config, bool DontHookUp, ScriptManager newScriptManager);
|
||||
ScriptManager GetScriptManager();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
{
|
||||
public class Compiler
|
||||
{
|
||||
|
||||
// * Uses "LSL2Converter" to convert LSL to C# if necessary.
|
||||
// * Compiles C#-code into an assembly
|
||||
// * Returns assembly name ready for AppDomain load.
|
||||
@@ -113,7 +112,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
AllowedCompilers.Clear();
|
||||
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Allowed languages: " + allowComp);
|
||||
m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Allowed languages: " + allowComp);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -122,18 +121,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
string strlan = strl.Trim(" \t".ToCharArray()).ToLower();
|
||||
if (!LanguageMapping.ContainsKey(strlan))
|
||||
{
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler is unable to recongnize language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
|
||||
m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Config OK. Compiler recongnized language type \"" + strlan + "\" specified in \"AllowedCompilers\".");
|
||||
#endif
|
||||
}
|
||||
AllowedCompilers.Add(strlan, true);
|
||||
}
|
||||
if (AllowedCompilers.Count == 0)
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!");
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Config error. Compiler could not recognize any language in \"AllowedCompilers\". Scripts will not be executed!");
|
||||
|
||||
// Default language
|
||||
string defaultCompileLanguage = m_scriptEngine.ScriptConfigSource.GetString("DefaultCompileLanguage", "lsl").ToLower();
|
||||
@@ -141,22 +140,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
// Is this language recognized at all?
|
||||
if (!LanguageMapping.ContainsKey(defaultCompileLanguage))
|
||||
{
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName,
|
||||
"Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\".");
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " +
|
||||
"Config error. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is not recognized as a valid language. Changing default to: \"lsl\".");
|
||||
defaultCompileLanguage = "lsl";
|
||||
}
|
||||
|
||||
// Is this language in allow-list?
|
||||
if (!AllowedCompilers.ContainsKey(defaultCompileLanguage))
|
||||
{
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName,
|
||||
"Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!");
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " +
|
||||
"Config error. Default language \"" + defaultCompileLanguage + "\"specified in \"DefaultCompileLanguage\" is not in list of \"AllowedCompilers\". Scripts may not be executed!");
|
||||
}
|
||||
else
|
||||
{
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName,
|
||||
"Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language.");
|
||||
m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: " +
|
||||
"Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language.");
|
||||
#endif
|
||||
// LANGUAGE IS IN ALLOW-LIST
|
||||
DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage];
|
||||
@@ -181,13 +180,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString());
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying to create ScriptEngine directory \"" + ScriptEnginesPath + "\": " + ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string file in Directory.GetFiles(ScriptEnginesPath))
|
||||
{
|
||||
//m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "FILE FOUND: " + file);
|
||||
//m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: FILE FOUND: " + file);
|
||||
|
||||
if (file.ToLower().StartsWith(FilePrefix + "_compiled_") ||
|
||||
file.ToLower().StartsWith(FilePrefix + "_source_"))
|
||||
@@ -198,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception trying delete old script file \"" + file + "\": " + ex.ToString());
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception trying delete old script file \"" + file + "\": " + ex.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -313,7 +312,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
Path.Combine("ScriptEngines",
|
||||
FilePrefix + "_compiled_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll");
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Starting compile of \"" + OutFile + "\".");
|
||||
m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Starting compile of \"" + OutFile + "\".");
|
||||
#endif
|
||||
try
|
||||
{
|
||||
@@ -321,7 +320,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString());
|
||||
//m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString());
|
||||
throw new Exception("Unable to delete old existring script-file before writing new. Compile aborted: " + e.ToString());
|
||||
}
|
||||
//string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll");
|
||||
@@ -338,7 +337,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString());
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception while trying to write script source to file \"" + srcFileName + "\": " + ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
public override void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
ConfigSource = config;
|
||||
InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager());
|
||||
InitializeEngine(scene, config, true, GetScriptManager());
|
||||
}
|
||||
|
||||
public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager()
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
|
||||
using System;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework;
|
||||
@@ -60,7 +61,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
|
||||
public override void _StartScript(uint localID, LLUUID itemID, string Script)
|
||||
{
|
||||
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
|
||||
m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
|
||||
|
||||
|
||||
//IScriptHost root = host.GetRoot();
|
||||
@@ -85,7 +86,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
|
||||
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
|
||||
m_scriptEngine.Log.Debug(String.Format("[" + m_scriptEngine.ScriptEngineName + "]: Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before));
|
||||
#endif
|
||||
|
||||
CompiledScript.Source = Script;
|
||||
@@ -106,7 +107,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString());
|
||||
//m_scriptEngine.Log.Error("[ScriptEngine]: Error compiling script: " + e.ToString());
|
||||
try
|
||||
{
|
||||
// DISPLAY ERROR INWORLD
|
||||
@@ -118,9 +119,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Error displaying error in-world: " + e2.ToString());
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName,
|
||||
"Errormessage: Error compiling script:\r\n" + e.Message.ToString());
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Error displaying error in-world: " + e2.ToString());
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: " +
|
||||
"Errormessage: Error compiling script:\r\n" + e.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +130,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
// Stop script
|
||||
#if DEBUG
|
||||
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Stop script localID: " + localID + " LLUID: " + itemID.ToString());
|
||||
m_scriptEngine.Log.Debug("[" + m_scriptEngine.ScriptEngineName + "]: Stop script localID: " + localID + " LLUID: " + itemID.ToString());
|
||||
#endif
|
||||
|
||||
// Stop long command on script
|
||||
@@ -142,7 +143,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
// TEMP: First serialize it
|
||||
//GetSerializedScript(localID, itemID);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// Get AppDomain
|
||||
@@ -156,10 +156,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
|
||||
": " + e.ToString());
|
||||
m_scriptEngine.Log.Error("[" + m_scriptEngine.ScriptEngineName + "]: Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
|
||||
": " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine
|
||||
// We need to override a few things for our DotNetEngine
|
||||
public override void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager());
|
||||
InitializeEngine(scene, config, true, GetScriptManager());
|
||||
}
|
||||
|
||||
public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager()
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//m_scriptEngine.Log.Error("ScriptEngine", "Error compiling script: " + e.ToString());
|
||||
//m_scriptEngine.Log.Error("[ScriptEngine]: Error compiling script: " + e.ToString());
|
||||
try
|
||||
{
|
||||
// DISPLAY ERROR INWORLD
|
||||
@@ -113,9 +113,9 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString());
|
||||
m_scriptEngine.Log.Error("ScriptEngine",
|
||||
"Errormessage: Error compiling script:\r\n" + e.Message.ToString());
|
||||
m_scriptEngine.Log.Error("[ScriptEngine]: Error displaying error in-world: " + e2.ToString());
|
||||
m_scriptEngine.Log.Error("[ScriptEngine]: " +
|
||||
"Errormessage: Error compiling script:\r\n" + e.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine
|
||||
// Stop script
|
||||
Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString());
|
||||
|
||||
|
||||
// Stop long command on script
|
||||
m_scriptEngine.m_ASYNCLSLCommandManager.RemoveScript(localID, itemID);
|
||||
|
||||
@@ -136,7 +135,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine
|
||||
// TEMP: First serialize it
|
||||
//GetSerializedScript(localID, itemID);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// Get AppDomain
|
||||
@@ -157,7 +155,6 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
{
|
||||
public static class Common
|
||||
@@ -43,15 +44,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
public static void SendToDebug(string Message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
mySE.Log.Verbose("ScriptEngine", "Debug: " + Message);
|
||||
mySE.Log.Info("[ScriptEngine]: Debug: " + Message);
|
||||
//SendToDebugEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
}
|
||||
|
||||
public static void SendToLog(string Message)
|
||||
{
|
||||
//if (Debug == true)
|
||||
mySE.Log.Verbose("ScriptEngine", "LOG: " + Message);
|
||||
mySE.Log.Info("[ScriptEngine]: LOG: " + Message);
|
||||
//SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
|
||||
using System;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework;
|
||||
@@ -40,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
[Serializable]
|
||||
internal class EventManager
|
||||
{
|
||||
|
||||
System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject>();
|
||||
TCPClient m_TCPClient;
|
||||
TRPC_Remote RPC;
|
||||
@@ -59,32 +59,28 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand);
|
||||
myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort);
|
||||
|
||||
myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events");
|
||||
myScriptEngine.Log.Info("[RemoteEngine]: Hooking up to server events");
|
||||
//myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
|
||||
myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
|
||||
//myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void RPC_ReceiveCommand(int ID, string Command, params object[] p)
|
||||
{
|
||||
myScriptEngine.Log.Notice("REMOTESERVER", "Received command: '" + Command + "'");
|
||||
myScriptEngine.Log.Info("[REMOTESERVER]: Received command: '" + Command + "'");
|
||||
if (p != null)
|
||||
{
|
||||
for (int i = 0; i < p.Length; i++)
|
||||
{
|
||||
myScriptEngine.Log.Notice("REMOTESERVER", "Param " + i + ": " + p[i].ToString());
|
||||
myScriptEngine.Log.Info("[REMOTESERVER]: Param " + i + ": " + p[i].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void OnRezScript(uint localID, LLUUID itemID, string script)
|
||||
{
|
||||
// WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID
|
||||
myScriptEngine.Log.Verbose("RemoteEngine", "Creating new script (with connection)");
|
||||
myScriptEngine.Log.Info("[RemoteEngine]: Creating new script (with connection)");
|
||||
|
||||
// Temp for now: We have one connection only - this is hardcoded in myScriptServerID
|
||||
RPC.SendCommand(myScriptServerID, "OnRezScript", localID, itemID.ToString(), script);
|
||||
@@ -92,18 +88,15 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
//ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234);
|
||||
//remoteScript.Add(localID, obj);
|
||||
//remoteScript[localID].Events().OnRezScript(localID, itemID, script);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
|
||||
{
|
||||
//remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient);
|
||||
//remoteScript[localID].Events.touch_start(localID, offsetPos, remoteClient);
|
||||
RPC.SendCommand(myScriptServerID, "touch_start", offsetPos, "How to transfer IClientAPI?");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// PLACEHOLDERS -- CODE WILL CHANGE!
|
||||
|
||||
|
||||
@@ -266,6 +259,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
//{
|
||||
// remoteScript[localID].Events.http_response(localID, itemID);
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
|
||||
using System;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework.Console;
|
||||
@@ -41,28 +42,27 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
[Serializable]
|
||||
public class ScriptEngine : IRegionModule
|
||||
{
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
internal Scene World;
|
||||
internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim
|
||||
internal RemoteServer m_RemoteServer; // Handles connections to remote servers
|
||||
|
||||
private LogBase m_log;
|
||||
|
||||
public ScriptEngine()
|
||||
{
|
||||
Common.mySE = this;
|
||||
}
|
||||
|
||||
public LogBase Log
|
||||
public log4net.ILog Log
|
||||
{
|
||||
get { return m_log; }
|
||||
}
|
||||
|
||||
public void InitializeEngine(Scene Sceneworld, LogBase logger)
|
||||
public void InitializeEngine(Scene Sceneworld)
|
||||
{
|
||||
World = Sceneworld;
|
||||
m_log = logger;
|
||||
|
||||
Log.Verbose("ScriptEngine", "RemoteEngine (Remote Script Server) initializing");
|
||||
m_log.Info("[ScriptEngine]: RemoteEngine (Remote Script Server) initializing");
|
||||
// Create all objects we'll be using
|
||||
m_EventManager = new EventManager(this);
|
||||
m_RemoteServer = new RemoteServer();
|
||||
@@ -74,12 +74,11 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
// We are shutting down
|
||||
}
|
||||
|
||||
|
||||
#region IRegionModule
|
||||
|
||||
public void Initialise(Scene scene, IConfigSource config)
|
||||
{
|
||||
InitializeEngine(scene, MainLog.Instance);
|
||||
InitializeEngine(scene);
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -101,6 +100,5 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user