aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-02-07 17:44:37 +0000
committerJustin Clark-Casey (justincc)2012-02-07 17:44:37 +0000
commit038d1bf742ba4f95ca8a83b27f6fefb755485524 (patch)
treeec03beab5a4c0a3afd75b685d629f9d82d4199b9 /OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
parentRevert my two quick fixes for the lag issue and put in the real fix, which (diff)
downloadopensim-SC_OLD-038d1bf742ba4f95ca8a83b27f6fefb755485524.zip
opensim-SC_OLD-038d1bf742ba4f95ca8a83b27f6fefb755485524.tar.gz
opensim-SC_OLD-038d1bf742ba4f95ca8a83b27f6fefb755485524.tar.bz2
opensim-SC_OLD-038d1bf742ba4f95ca8a83b27f6fefb755485524.tar.xz
Add a regression test to compile and start a script. Remove Path.GetDirectoryName when getting assembly loading path in Compiler.CompileFromDotNetText().
The Path.GetDirectoryName call in Compiler.CompileFromDotNetText is unnecessary since AppDomain.CurrentDomain.BaseDirectory is always a directory. Later path concatenation is already done by Path.Combine() which handles any trailing slash. Removing Path.GetDirectoryName() will not affect the runtime but allows NUnit to work since it doesn't add a trailing slash to AppDomain.CurrentDomain.BaseDirectory.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs23
1 files changed, 21 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index f11987e..c68f03f 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -680,6 +680,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
680 680
681 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) 681 public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource)
682 { 682 {
683// m_log.DebugFormat(
684// "[XEngine]: OnRezScript event triggered for script {0}, startParam {1}, postOnRez {2}, engine {3}, stateSource {4}, script\n{5}",
685// itemID, startParam, postOnRez, engine, stateSource, script);
686
683 if (script.StartsWith("//MRM:")) 687 if (script.StartsWith("//MRM:"))
684 return; 688 return;
685 689
@@ -761,6 +765,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
761 m_CompileDict[itemID] = 0; 765 m_CompileDict[itemID] = 0;
762 } 766 }
763 767
768// m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID);
769
764 if (m_CurrentCompile == null) 770 if (m_CurrentCompile == null)
765 { 771 {
766 // NOTE: Although we use a lockless queue, the lock here 772 // NOTE: Although we use a lockless queue, the lock here
@@ -822,6 +828,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
822 bool postOnRez = (bool)p[4]; 828 bool postOnRez = (bool)p[4];
823 StateSource stateSource = (StateSource)p[5]; 829 StateSource stateSource = (StateSource)p[5];
824 830
831// m_log.DebugFormat("[XEngine]: DoOnRezScript called for script {0}", itemID);
832
825 lock (m_CompileDict) 833 lock (m_CompileDict)
826 { 834 {
827 if (!m_CompileDict.ContainsKey(itemID)) 835 if (!m_CompileDict.ContainsKey(itemID))
@@ -870,7 +878,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
870 { 878 {
871 try 879 try
872 { 880 {
873 lock (m_AddingAssemblies) 881 lock (m_AddingAssemblies)
874 { 882 {
875 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); 883 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
876 if (!m_AddingAssemblies.ContainsKey(assembly)) { 884 if (!m_AddingAssemblies.ContainsKey(assembly)) {
@@ -922,6 +930,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
922 } 930 }
923 catch (Exception e) 931 catch (Exception e)
924 { 932 {
933// m_log.ErrorFormat("[XEngine]: Exception when rezzing script {0}{1}", e.Message, e.StackTrace);
934
925 // try 935 // try
926 // { 936 // {
927 if (!m_ScriptErrors.ContainsKey(itemID)) 937 if (!m_ScriptErrors.ContainsKey(itemID))
@@ -1132,7 +1142,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1132 handlerObjectRemoved(part.UUID); 1142 handlerObjectRemoved(part.UUID);
1133 } 1143 }
1134 1144
1135
1136 ScriptRemoved handlerScriptRemoved = OnScriptRemoved; 1145 ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
1137 if (handlerScriptRemoved != null) 1146 if (handlerScriptRemoved != null)
1138 handlerScriptRemoved(itemID); 1147 handlerScriptRemoved(itemID);
@@ -1381,6 +1390,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1381 string path = Path.Combine(Directory.GetCurrentDirectory(), 1390 string path = Path.Combine(Directory.GetCurrentDirectory(),
1382 Path.Combine(s, assemblyName))+".dll"; 1391 Path.Combine(s, assemblyName))+".dll";
1383 1392
1393// Console.WriteLine("[XEngine]: Trying to resolve {0}", path);
1394
1384 if (File.Exists(path)) 1395 if (File.Exists(path))
1385 return Assembly.LoadFrom(path); 1396 return Assembly.LoadFrom(path);
1386 } 1397 }
@@ -1863,16 +1874,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1863 1874
1864 public void SuspendScript(UUID itemID) 1875 public void SuspendScript(UUID itemID)
1865 { 1876 {
1877// m_log.DebugFormat("[XEngine]: Received request to suspend script with ID {0}", itemID);
1878
1866 IScriptInstance instance = GetInstance(itemID); 1879 IScriptInstance instance = GetInstance(itemID);
1867 if (instance != null) 1880 if (instance != null)
1868 instance.Suspend(); 1881 instance.Suspend();
1882// else
1883// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
1869 } 1884 }
1870 1885
1871 public void ResumeScript(UUID itemID) 1886 public void ResumeScript(UUID itemID)
1872 { 1887 {
1888// m_log.DebugFormat("[XEngine]: Received request to resume script with ID {0}", itemID);
1889
1873 IScriptInstance instance = GetInstance(itemID); 1890 IScriptInstance instance = GetInstance(itemID);
1874 if (instance != null) 1891 if (instance != null)
1875 instance.Resume(); 1892 instance.Resume();
1893// else
1894// m_log.DebugFormat("[XEngine]: Could not find script with ID {0} to resume", itemID);
1876 } 1895 }
1877 } 1896 }
1878} \ No newline at end of file 1897} \ No newline at end of file