From cef8c5e9d7ce49cc47e7ef1816465064d889d6d5 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Thu, 13 Sep 2007 11:11:08 +0000 Subject: Hiding evidence that I once was a VB coder (thanks to refactoring). Renamed member names to smallcapsy. --- OpenSim/Framework/Data/SimProfileData.cs | 1 - OpenSim/Framework/UserManager/LoginService.cs | 1 + .../ScriptEngine/DotNetEngine/AppDomainManager.cs | 44 ++++++------- OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs | 2 +- .../DotNetEngine/Compiler/LSL/Compiler.cs | 6 +- .../DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 32 +++++----- .../Compiler/Server_API/LSL_BuiltIn_Commands.cs | 2 +- .../ScriptEngine/DotNetEngine/EventManager.cs | 6 +- .../ScriptEngine/DotNetEngine/EventQueueManager.cs | 72 +++++++++++----------- .../ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs | 30 ++++----- .../ScriptEngine/DotNetEngine/ScriptEngine.cs | 20 +++--- .../ScriptEngine/DotNetEngine/ScriptManager.cs | 58 ++++++++--------- OpenSim/Tools/OpenSim.GUI/Main.cs | 6 +- 13 files changed, 140 insertions(+), 140 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Data/SimProfileData.cs b/OpenSim/Framework/Data/SimProfileData.cs index 27bbd60..abde1f3 100644 --- a/OpenSim/Framework/Data/SimProfileData.cs +++ b/OpenSim/Framework/Data/SimProfileData.cs @@ -164,7 +164,6 @@ namespace OpenSim.Framework.Data ArrayList SendParams = new ArrayList(); SendParams.Add(requestData); XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); - Console.WriteLine("Requesting response from GridServer URL: " + gridserver_url); XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); Hashtable responseData = (Hashtable)GridResp.Value; diff --git a/OpenSim/Framework/UserManager/LoginService.cs b/OpenSim/Framework/UserManager/LoginService.cs index e50c65c..0af341e 100644 --- a/OpenSim/Framework/UserManager/LoginService.cs +++ b/OpenSim/Framework/UserManager/LoginService.cs @@ -173,6 +173,7 @@ namespace OpenSim.Framework.UserManagement /// Authenticated? public virtual bool AuthenticateUser(UserProfileData profile, string password) { + MainLog.Instance.Verbose( "Authenticating " + profile.username + " " + profile.surname); diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs index 14343b1..96670f1 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs @@ -15,11 +15,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { public class AppDomainManager { - private int MaxScriptsPerAppDomain = 1; + private int maxScriptsPerAppDomain = 1; /// /// Internal list of all AppDomains /// - private List AppDomains = new List(); + private List appDomains = new List(); /// /// Structure to keep track of data around AppDomain /// @@ -41,9 +41,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// /// Current AppDomain /// - private AppDomainStructure CurrentAD; - private object GetLock = new object(); // Mutex - private object FreeLock = new object(); // Mutex + private AppDomainStructure currentAD; + private object getLock = new object(); // Mutex + private object freeLock = new object(); // Mutex //private ScriptEngine m_scriptEngine; //public AppDomainManager(ScriptEngine scriptEngine) @@ -59,25 +59,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine private AppDomainStructure GetFreeAppDomain() { Console.WriteLine("Finding free AppDomain"); - lock (GetLock) + lock (getLock) { // Current full? - if (CurrentAD != null && CurrentAD.ScriptsLoaded >= MaxScriptsPerAppDomain) + if (currentAD != null && currentAD.ScriptsLoaded >= maxScriptsPerAppDomain) { // Add it to AppDomains list and empty current - AppDomains.Add(CurrentAD); - CurrentAD = null; + appDomains.Add(currentAD); + currentAD = null; } // No current - if (CurrentAD == null) + if (currentAD == null) { // Create a new current AppDomain - CurrentAD = new AppDomainStructure(); - CurrentAD.CurrentAppDomain = PrepareNewAppDomain(); + currentAD = new AppDomainStructure(); + currentAD.CurrentAppDomain = PrepareNewAppDomain(); } - Console.WriteLine("Scripts loaded in this Appdomain: " + CurrentAD.ScriptsLoaded); - return CurrentAD; + Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded); + return currentAD; } // lock } @@ -112,13 +112,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// private void UnloadAppDomains() { - lock (FreeLock) + lock (freeLock) { // Go through all - foreach (AppDomainStructure ads in new System.Collections.ArrayList(AppDomains)) + foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) { // Don't process current AppDomain - if (ads.CurrentAppDomain != CurrentAD.CurrentAppDomain) + if (ads.CurrentAppDomain != currentAD.CurrentAppDomain) { // Not current AppDomain // Is number of unloaded bigger or equal to number of loaded? @@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { Console.WriteLine("Found empty AppDomain, unloading"); // Remove from internal list - AppDomains.Remove(ads); + appDomains.Remove(ads); #if DEBUG long m = GC.GetTotalMemory(true); #endif @@ -164,19 +164,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine //[Obsolete("Needs fixing, needs a real purpose in life!!!")] public void StopScript(AppDomain ad) { - lock (FreeLock) + lock (freeLock) { Console.WriteLine("Stopping script in AppDomain"); // Check if it is current AppDomain - if (CurrentAD.CurrentAppDomain == ad) + if (currentAD.CurrentAppDomain == ad) { // Yes - increase - CurrentAD.ScriptsWaitingUnload++; + currentAD.ScriptsWaitingUnload++; return; } // Lopp through all AppDomains - foreach (AppDomainStructure ads in new System.Collections.ArrayList(AppDomains)) + foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains)) { if (ads.CurrentAppDomain == ad) { diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs index f5b40dc..5722d62 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs @@ -34,7 +34,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { public static class Common { - static public bool Debug = true; + static public bool debug = true; static public ScriptEngine mySE; //public delegate void SendToDebugEventDelegate(string Message); diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 0cce317..a488b91 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs @@ -13,7 +13,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); private CSharpCodeProvider codeProvider = new CSharpCodeProvider(); - private static UInt64 ScriptCompileCounter = 0; + private static UInt64 scriptCompileCounter = 0; //private ICodeCompiler icc = codeProvider.CreateCompiler(); public string CompileFromFile(string LSOFileName) { @@ -49,8 +49,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL // Output assembly name - ScriptCompileCounter++; - string OutFile = Path.Combine("ScriptEngines", "Script_" + ScriptCompileCounter + ".dll"); + scriptCompileCounter++; + string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); try { System.IO.File.Delete(OutFile); diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 9495888..3adb7e2 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs @@ -8,21 +8,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL public class LSL2CSConverter { //private Regex rnw = new Regex(@"[a-zA-Z0-9_\-]", RegexOptions.Compiled); - private Dictionary DataTypes = new Dictionary(); - private Dictionary QUOTES = new Dictionary(); + private Dictionary dataTypes = new Dictionary(); + private Dictionary quotes = new Dictionary(); public LSL2CSConverter() { // Only the types we need to convert - DataTypes.Add("void", "void"); - DataTypes.Add("integer", "int"); - DataTypes.Add("float", "double"); - DataTypes.Add("string", "string"); - DataTypes.Add("key", "string"); - DataTypes.Add("vector", "LSL_Types.Vector3"); - DataTypes.Add("rotation", "LSL_Types.Quaternion"); - DataTypes.Add("list", "list"); - DataTypes.Add("null", "null"); + dataTypes.Add("void", "void"); + dataTypes.Add("integer", "int"); + dataTypes.Add("float", "double"); + dataTypes.Add("string", "string"); + dataTypes.Add("key", "string"); + dataTypes.Add("vector", "LSL_Types.Vector3"); + dataTypes.Add("rotation", "LSL_Types.Quaternion"); + dataTypes.Add("list", "list"); + dataTypes.Add("null", "null"); } @@ -74,7 +74,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL _Script += quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]); } // We just left a quote - QUOTES.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); + quotes.Add(quote_replacement_string + quote_replaced_count.ToString().PadLeft(5, "0".ToCharArray()[0]), quote); quote = ""; } break; @@ -189,10 +189,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL - foreach (string key in DataTypes.Keys) + foreach (string key in dataTypes.Keys) { string val; - DataTypes.TryGetValue(key, out val); + dataTypes.TryGetValue(key, out val); // Replace CAST - (integer) with (int) Script = Regex.Replace(Script, @"\(" + key + @"\)", @"(" + val + ")", RegexOptions.Compiled | RegexOptions.Multiline); @@ -217,10 +217,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL // REPLACE BACK QUOTES - foreach (string key in QUOTES.Keys) + foreach (string key in quotes.Keys) { string val; - QUOTES.TryGetValue(key, out val); + quotes.TryGetValue(key, out val); Script = Script.Replace(key, "\"" + val + "\""); } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index bdab104..8f9f4e9 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs @@ -302,7 +302,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public void llSetTimerEvent(double sec) { // Setting timer repeat - m_ScriptEngine.myLSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); + m_ScriptEngine.m_LSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); } public void llSleep(double sec) diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index 220aa1d..979865c 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Add to queue for all scripts in ObjectID object //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); //Console.WriteLine("touch_start localID: " + localID); - myScriptEngine.myEventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); + myScriptEngine.m_EventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); } public void OnRezScript(uint localID, LLUUID itemID, string script) { @@ -72,7 +72,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() //); Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); - myScriptEngine.myScriptManager.StartScript(localID, itemID, script); + myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script); } public void OnRemoveScript(uint localID, LLUUID itemID) { @@ -81,7 +81,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() //); Console.WriteLine("OnRemoveScript localID: " + localID + " LLUID: " + itemID.ToString()); - myScriptEngine.myScriptManager.StopScript( + myScriptEngine.m_ScriptManager.StopScript( localID, itemID ); diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs index dde0a77..3dc5d77 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs @@ -47,20 +47,20 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// /// List of threads processing event queue /// - private List EventQueueThreads = new List(); - private object QueueLock = new object(); // Mutex lock object + private List eventQueueThreads = new List(); + private object queueLock = new object(); // Mutex lock object /// /// How many ms to sleep if queue is empty /// - private int NothingToDoSleepms = 50; + private int nothingToDoSleepms = 50; /// /// How many threads to process queue with /// - private int NumberOfThreads = 2; + private int numberOfThreads = 2; /// /// Queue containing events waiting to be executed /// - private Queue EventQueue = new Queue(); + private Queue eventQueue = new Queue(); /// /// Queue item structure /// @@ -68,28 +68,28 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { public uint localID; public LLUUID itemID; - public string FunctionName; + public string functionName; public object[] param; } /// /// List of localID locks for mutex processing of script events /// - private List ObjectLocks = new List(); - private object TryLockLock = new object(); // Mutex lock object + private List objectLocks = new List(); + private object tryLockLock = new object(); // Mutex lock object - private ScriptEngine myScriptEngine; + private ScriptEngine m_ScriptEngine; public EventQueueManager(ScriptEngine _ScriptEngine) { - myScriptEngine = _ScriptEngine; + m_ScriptEngine = _ScriptEngine; // // Start event queue processing threads (worker threads) // - for (int ThreadCount = 0; ThreadCount <= NumberOfThreads; ThreadCount++) + for (int ThreadCount = 0; ThreadCount <= numberOfThreads; ThreadCount++) { Thread EventQueueThread = new Thread(EventQueueThreadLoop); - EventQueueThreads.Add(EventQueueThread); + eventQueueThreads.Add(EventQueueThread); EventQueueThread.IsBackground = true; EventQueueThread.Priority = ThreadPriority.BelowNormal; EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount; @@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { // Kill worker threads - foreach (Thread EventQueueThread in new System.Collections.ArrayList(EventQueueThreads)) + foreach (Thread EventQueueThread in new System.Collections.ArrayList(eventQueueThreads)) { if (EventQueueThread != null && EventQueueThread.IsAlive == true) { @@ -115,9 +115,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine } } } - EventQueueThreads.Clear(); + eventQueueThreads.Clear(); // Todo: Clean up our queues - EventQueue.Clear(); + eventQueue.Clear(); } @@ -137,10 +137,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine QueueItemStruct QIS = BlankQIS; bool GotItem = false; - if (EventQueue.Count == 0) + if (eventQueue.Count == 0) { // Nothing to do? Sleep a bit waiting for something to do - Thread.Sleep(NothingToDoSleepms); + Thread.Sleep(nothingToDoSleepms); } else { @@ -148,19 +148,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine //myScriptEngine.m_logger.Verbose("ScriptEngine", "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 (QueueLock) + lock (queueLock) { GotItem = false; - for (int qc = 0; qc < EventQueue.Count; qc++) + for (int qc = 0; qc < eventQueue.Count; qc++) { // Get queue item - QIS = EventQueue.Dequeue(); + QIS = eventQueue.Dequeue(); // Check if object is being processed by someone else if (TryLock(QIS.localID) == false) { // Object is already being processed, requeue it - EventQueue.Enqueue(QIS); + eventQueue.Enqueue(QIS); } else { @@ -176,12 +176,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Execute function try { - myScriptEngine.myScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.FunctionName, QIS.param); + m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, QIS.functionName, QIS.param); } catch (Exception e) { // DISPLAY ERROR INWORLD - string text = "Error executing script function \"" + QIS.FunctionName + "\":\r\n"; + string text = "Error executing script function \"" + QIS.functionName + "\":\r\n"; if (e.InnerException != null) { // Send inner exception text += e.InnerException.Message.ToString(); @@ -194,10 +194,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { if (text.Length > 1500) text = text.Substring(0, 1500); - IScriptHost m_host = myScriptEngine.World.GetSceneObjectPart(QIS.localID); + IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); //if (m_host != null) //{ - myScriptEngine.World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID); + m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID); } catch { //} //else @@ -234,15 +234,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// private bool TryLock(uint localID) { - lock (TryLockLock) + lock (tryLockLock) { - if (ObjectLocks.Contains(localID) == true) + if (objectLocks.Contains(localID) == true) { return false; } else { - ObjectLocks.Add(localID); + objectLocks.Add(localID); return true; } } @@ -254,11 +254,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// private void ReleaseLock(uint localID) { - lock (TryLockLock) + lock (tryLockLock) { - if (ObjectLocks.Contains(localID) == true) + if (objectLocks.Contains(localID) == true) { - ObjectLocks.Remove(localID); + objectLocks.Remove(localID); } } } @@ -277,13 +277,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Do we have any scripts in this object at all? If not, return - if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false) + if (m_ScriptEngine.m_ScriptManager.Scripts.ContainsKey(localID) == false) { //Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID."); return; } - Dictionary.KeyCollection scriptKeys = myScriptEngine.myScriptManager.GetScriptKeys(localID); + Dictionary.KeyCollection scriptKeys = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID); foreach ( LLUUID itemID in scriptKeys ) { @@ -303,17 +303,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// Array of parameters to match event mask public void AddToScriptQueue(uint localID, LLUUID itemID, string FunctionName, object[] param) { - lock (QueueLock) + lock (queueLock) { // Create a structure and add data QueueItemStruct QIS = new QueueItemStruct(); QIS.localID = localID; QIS.itemID = itemID; - QIS.FunctionName = FunctionName; + QIS.functionName = FunctionName; QIS.param = param; // Add it to queue - EventQueue.Enqueue(QIS); + eventQueue.Enqueue(QIS); } } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs index 5ce972a..7ce6556 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs @@ -11,32 +11,32 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// class LSLLongCmdHandler { - private Thread CmdHandlerThread; - private int CmdHandlerThreadCycleSleepms = 100; + private Thread cmdHandlerThread; + private int cmdHandlerThreadCycleSleepms = 100; - private ScriptEngine myScriptEngine; + private ScriptEngine m_ScriptEngine; public LSLLongCmdHandler(ScriptEngine _ScriptEngine) { - myScriptEngine = _ScriptEngine; + m_ScriptEngine = _ScriptEngine; // Start the thread that will be doing the work - CmdHandlerThread = new Thread(CmdHandlerThreadLoop); - CmdHandlerThread.Name = "CmdHandlerThread"; - CmdHandlerThread.Priority = ThreadPriority.BelowNormal; - CmdHandlerThread.IsBackground = true; - CmdHandlerThread.Start(); + cmdHandlerThread = new Thread(CmdHandlerThreadLoop); + cmdHandlerThread.Name = "CmdHandlerThread"; + cmdHandlerThread.Priority = ThreadPriority.BelowNormal; + cmdHandlerThread.IsBackground = true; + cmdHandlerThread.Start(); } ~LSLLongCmdHandler() { // Shut down thread try { - if (CmdHandlerThread != null) + if (cmdHandlerThread != null) { - if (CmdHandlerThread.IsAlive == true) + if (cmdHandlerThread.IsAlive == true) { - CmdHandlerThread.Abort(); - CmdHandlerThread.Join(); + cmdHandlerThread.Abort(); + cmdHandlerThread.Join(); } } } @@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine CheckTimerEvents(); // Sleep before next cycle - Thread.Sleep(CmdHandlerThreadCycleSleepms); + Thread.Sleep(cmdHandlerThreadCycleSleepms); } } @@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) { // Add it to queue - myScriptEngine.myEventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); + m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); // set next interval diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index c743321..73cf851 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -45,11 +45,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { internal OpenSim.Region.Environment.Scenes.Scene World; - internal EventManager myEventManager; // Handles and queues incoming events from OpenSim - internal EventQueueManager myEventQueueManager; // Executes events - internal ScriptManager myScriptManager; // Load, unload and execute scripts - internal AppDomainManager myAppDomainManager; - internal LSLLongCmdHandler myLSLLongCmdHandler; + internal EventManager m_EventManager; // Handles and queues incoming events from OpenSim + internal EventQueueManager m_EventQueueManager; // Executes events + internal ScriptManager m_ScriptManager; // Load, unload and execute scripts + internal AppDomainManager m_AppDomainManager; + internal LSLLongCmdHandler m_LSLLongCmdHandler; private OpenSim.Framework.Console.LogBase m_log; @@ -75,11 +75,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine //m_logger.Status("ScriptEngine", "InitializeEngine"); // Create all objects we'll be using - myEventQueueManager = new EventQueueManager(this); - myEventManager = new EventManager(this); - myScriptManager = new ScriptManager(this); - myAppDomainManager = new AppDomainManager(); - myLSLLongCmdHandler = new LSLLongCmdHandler(this); + m_EventQueueManager = new EventQueueManager(this); + m_EventManager = new EventManager(this); + m_ScriptManager = new ScriptManager(this); + m_AppDomainManager = new AppDomainManager(); + m_LSLLongCmdHandler = new LSLLongCmdHandler(this); // 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? diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 5a7b5d3..055acc4 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -53,15 +53,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine public class ScriptManager { #region Declares - private Thread ScriptLoadUnloadThread; - private int ScriptLoadUnloadThread_IdleSleepms = 100; - private Queue LoadQueue = new Queue(); - private Queue UnloadQueue = new Queue(); + private Thread scriptLoadUnloadThread; + private int scriptLoadUnloadThread_IdleSleepms = 100; + private Queue loadQueue = new Queue(); + private Queue unloadQueue = new Queue(); private struct LoadStruct { public uint localID; public LLUUID itemID; - public string Script; + public string script; } private struct UnloadStruct { @@ -87,11 +87,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { m_scriptEngine = scriptEngine; AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); - ScriptLoadUnloadThread = new Thread(ScriptLoadUnloadThreadLoop); - ScriptLoadUnloadThread.Name = "ScriptLoadUnloadThread"; - ScriptLoadUnloadThread.IsBackground = true; - ScriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; - ScriptLoadUnloadThread.Start(); + scriptLoadUnloadThread = new Thread(ScriptLoadUnloadThreadLoop); + scriptLoadUnloadThread.Name = "ScriptLoadUnloadThread"; + scriptLoadUnloadThread.IsBackground = true; + scriptLoadUnloadThread.Priority = ThreadPriority.BelowNormal; + scriptLoadUnloadThread.Start(); } ~ScriptManager () @@ -99,12 +99,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Abort load/unload thread try { - if (ScriptLoadUnloadThread != null) + if (scriptLoadUnloadThread != null) { - if (ScriptLoadUnloadThread.IsAlive == true) + if (scriptLoadUnloadThread.IsAlive == true) { - ScriptLoadUnloadThread.Abort(); - ScriptLoadUnloadThread.Join(); + scriptLoadUnloadThread.Abort(); + scriptLoadUnloadThread.Join(); } } } @@ -120,18 +120,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { while (true) { - if (LoadQueue.Count == 0 && UnloadQueue.Count == 0) - Thread.Sleep(ScriptLoadUnloadThread_IdleSleepms); + if (loadQueue.Count == 0 && unloadQueue.Count == 0) + Thread.Sleep(scriptLoadUnloadThread_IdleSleepms); - if (LoadQueue.Count > 0) + if (loadQueue.Count > 0) { - LoadStruct item = LoadQueue.Dequeue(); - _StartScript(item.localID, item.itemID, item.Script); + LoadStruct item = loadQueue.Dequeue(); + _StartScript(item.localID, item.itemID, item.script); } - if (UnloadQueue.Count > 0) + if (unloadQueue.Count > 0) { - UnloadStruct item = UnloadQueue.Dequeue(); + UnloadStruct item = unloadQueue.Dequeue(); _StopScript(item.localID, item.itemID); } @@ -232,8 +232,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine LoadStruct ls = new LoadStruct(); ls.localID = localID; ls.itemID = itemID; - ls.Script = Script; - LoadQueue.Enqueue(ls); + ls.script = Script; + loadQueue.Enqueue(ls); } /// /// Disables and unloads a script @@ -245,7 +245,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine UnloadStruct ls = new UnloadStruct(); ls.localID = localID; ls.itemID = itemID; - UnloadQueue.Enqueue(ls); + unloadQueue.Enqueue(ls); } private void _StartScript(uint localID, LLUUID itemID, string Script) @@ -279,7 +279,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine before = GC.GetTotalMemory(true); #endif LSL_BaseClass CompiledScript; - CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName); + CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(FileName); #if DEBUG Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); #endif @@ -297,7 +297,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine CompiledScript.Start(LSLB); // Fire the first start-event - m_scriptEngine.myEventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); + m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); } @@ -329,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Stop long command on script - m_scriptEngine.myLSLLongCmdHandler.RemoveScript(localID, itemID); + m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID); LSL_BaseClass LSLBC = GetScript(localID, itemID); if (LSLBC == null) @@ -348,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Remove from internal structure RemoveScript(localID, itemID); // Tell AppDomain that we have stopped script - m_scriptEngine.myAppDomainManager.StopScript(ad); + m_scriptEngine.m_AppDomainManager.StopScript(ad); } catch(Exception e) { @@ -375,7 +375,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Execute a function in the script //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); - LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(localID, itemID); + LSL_BaseClass Script = m_scriptEngine.m_ScriptManager.GetScript(localID, itemID); if (Script == null) return; diff --git a/OpenSim/Tools/OpenSim.GUI/Main.cs b/OpenSim/Tools/OpenSim.GUI/Main.cs index 611ddd9..0b5af28 100644 --- a/OpenSim/Tools/OpenSim.GUI/Main.cs +++ b/OpenSim/Tools/OpenSim.GUI/Main.cs @@ -112,7 +112,7 @@ namespace OpenSim.GUI proc_UserServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); proc_UserServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); proc_UserServer.StartProcess(); - System.Threading.Thread.Sleep(2000); + System.Threading.Thread.Sleep(3000); // Start GridServer proc_GridServer = new ProcessManager("OpenSim.Grid.GridServer.exe", ""); @@ -120,7 +120,7 @@ namespace OpenSim.GUI proc_GridServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); proc_GridServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); proc_GridServer.StartProcess(); - System.Threading.Thread.Sleep(2000); + System.Threading.Thread.Sleep(3000); // Start AssetServer proc_AssetServer = new ProcessManager("OpenSim.Grid.AssetServer.exe", ""); @@ -128,7 +128,7 @@ namespace OpenSim.GUI proc_AssetServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); proc_AssetServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); proc_AssetServer.StartProcess(); - System.Threading.Thread.Sleep(2000); + System.Threading.Thread.Sleep(3000); } // Start OpenSim -- cgit v1.1