aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs17
8 files changed, 43 insertions, 41 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
index 3cbdde5..693992a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
@@ -233,17 +233,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
233 m_Timer[engine].UnSetTimerEvents(localID, itemID); 233 m_Timer[engine].UnSetTimerEvents(localID, itemID);
234 234
235 // Remove from: HttpRequest 235 // Remove from: HttpRequest
236 IHttpRequestModule iHttpReq = 236 IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface<IHttpRequestModule>();
237 engine.World.RequestModuleInterface<IHttpRequestModule>(); 237 if (iHttpReq != null)
238 iHttpReq.StopHttpRequest(localID, itemID); 238 iHttpReq.StopHttpRequest(localID, itemID);
239 239
240 IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>(); 240 IWorldComm comms = engine.World.RequestModuleInterface<IWorldComm>();
241 if (comms != null) 241 if (comms != null)
242 comms.DeleteListener(itemID); 242 comms.DeleteListener(itemID);
243 243
244 IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>(); 244 IXMLRPC xmlrpc = engine.World.RequestModuleInterface<IXMLRPC>();
245 xmlrpc.DeleteChannels(itemID); 245 if (xmlrpc != null)
246 xmlrpc.CancelSRDRequests(itemID); 246 {
247 xmlrpc.DeleteChannels(itemID);
248 xmlrpc.CancelSRDRequests(itemID);
249 }
247 250
248 // Remove Sensors 251 // Remove Sensors
249 m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); 252 m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
@@ -325,7 +328,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
325 { 328 {
326 List<Object> data = new List<Object>(); 329 List<Object> data = new List<Object>();
327 330
328 Object[] listeners=m_Listener[engine].GetSerializationData(itemID); 331 Object[] listeners = m_Listener[engine].GetSerializationData(itemID);
329 if (listeners.Length > 0) 332 if (listeners.Length > 0)
330 { 333 {
331 data.Add("listener"); 334 data.Add("listener");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index e9db5d5..fed3122 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -11918,9 +11918,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11918 return; 11918 return;
11919 } 11919 }
11920 11920
11921 System.Text.UTF8Encoding enc = 11921 string data = Encoding.UTF8.GetString(a.Data);
11922 new System.Text.UTF8Encoding();
11923 string data = enc.GetString(a.Data);
11924 //m_log.Debug(data); 11922 //m_log.Debug(data);
11925 NotecardCache.Cache(id, data); 11923 NotecardCache.Cache(id, data);
11926 AsyncCommands. 11924 AsyncCommands.
@@ -11973,9 +11971,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11973 return; 11971 return;
11974 } 11972 }
11975 11973
11976 System.Text.UTF8Encoding enc = 11974 string data = Encoding.UTF8.GetString(a.Data);
11977 new System.Text.UTF8Encoding();
11978 string data = enc.GetString(a.Data);
11979 //m_log.Debug(data); 11975 //m_log.Debug(data);
11980 NotecardCache.Cache(id, data); 11976 NotecardCache.Cache(id, data);
11981 AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), 11977 AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(),
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index b639d36..4d20f7b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1822,8 +1822,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1822 if (a == null) 1822 if (a == null)
1823 return UUID.Zero; 1823 return UUID.Zero;
1824 1824
1825 System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); 1825 string data = Encoding.UTF8.GetString(a.Data);
1826 string data = enc.GetString(a.Data);
1827 NotecardCache.Cache(assetID, data); 1826 NotecardCache.Cache(assetID, data);
1828 }; 1827 };
1829 1828
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
index 93e0261..efa86fc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs
@@ -88,13 +88,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
88 88
89 public Object[] GetSerializationData(UUID itemID) 89 public Object[] GetSerializationData(UUID itemID)
90 { 90 {
91 return m_commsPlugin.GetSerializationData(itemID); 91 if (m_commsPlugin != null)
92 return m_commsPlugin.GetSerializationData(itemID);
93 else
94 return new Object[]{};
92 } 95 }
93 96
94 public void CreateFromData(uint localID, UUID itemID, UUID hostID, 97 public void CreateFromData(uint localID, UUID itemID, UUID hostID,
95 Object[] data) 98 Object[] data)
96 { 99 {
97 m_commsPlugin.CreateFromData(localID, itemID, hostID, data); 100 if (m_commsPlugin != null)
101 m_commsPlugin.CreateFromData(localID, itemID, hostID, data);
98 } 102 }
99 } 103 }
100} \ No newline at end of file 104} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 8f2ec49..17a0d69 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Globalization; 31using System.Globalization;
32using System.Reflection; 32using System.Reflection;
33using System.IO; 33using System.IO;
34using System.Text;
34using Microsoft.CSharp; 35using Microsoft.CSharp;
35//using Microsoft.JScript; 36//using Microsoft.JScript;
36using Microsoft.VisualBasic; 37using Microsoft.VisualBasic;
@@ -711,9 +712,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
711 // 712 //
712 string filetext = System.Convert.ToBase64String(data); 713 string filetext = System.Convert.ToBase64String(data);
713 714
714 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 715 Byte[] buf = Encoding.ASCII.GetBytes(filetext);
715
716 Byte[] buf = enc.GetBytes(filetext);
717 716
718 FileStream sfs = File.Create(assembly + ".text"); 717 FileStream sfs = File.Create(assembly + ".text");
719 sfs.Write(buf, 0, buf.Length); 718 sfs.Write(buf, 0, buf.Length);
@@ -804,8 +803,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
804 mapstring += String.Format("{0},{1},{2},{3}\n", k.Key, k.Value, v.Key, v.Value); 803 mapstring += String.Format("{0},{1},{2},{3}\n", k.Key, k.Value, v.Key, v.Value);
805 } 804 }
806 805
807 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); 806 Byte[] mapbytes = Encoding.ASCII.GetBytes(mapstring);
808 Byte[] mapbytes = enc.GetBytes(mapstring);
809 FileStream mfs = File.Create(filename); 807 FileStream mfs = File.Create(filename);
810 mfs.Write(mapbytes, 0, mapbytes.Length); 808 mfs.Write(mapbytes, 0, mapbytes.Length);
811 mfs.Close(); 809 mfs.Close();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 3797683..3ddf1d4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -26,16 +26,17 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Globalization;
29using System.IO; 32using System.IO;
30using System.Diagnostics; //for [DebuggerNonUserCode] 33using System.Diagnostics; //for [DebuggerNonUserCode]
34using System.Reflection;
31using System.Runtime.Remoting; 35using System.Runtime.Remoting;
32using System.Runtime.Remoting.Lifetime; 36using System.Runtime.Remoting.Lifetime;
33using System.Threading;
34using System.Collections;
35using System.Collections.Generic;
36using System.Security.Policy; 37using System.Security.Policy;
37using System.Reflection; 38using System.Text;
38using System.Globalization; 39using System.Threading;
39using System.Xml; 40using System.Xml;
40using OpenMetaverse; 41using OpenMetaverse;
41using log4net; 42using log4net;
@@ -298,13 +299,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
298 using (FileStream fs = File.Open(savedState, 299 using (FileStream fs = File.Open(savedState,
299 FileMode.Open, FileAccess.Read, FileShare.None)) 300 FileMode.Open, FileAccess.Read, FileShare.None))
300 { 301 {
301 System.Text.UTF8Encoding enc =
302 new System.Text.UTF8Encoding();
303
304 Byte[] data = new Byte[size]; 302 Byte[] data = new Byte[size];
305 fs.Read(data, 0, size); 303 fs.Read(data, 0, size);
306 304
307 xml = enc.GetString(data); 305 xml = Encoding.UTF8.GetString(data);
308 306
309 ScriptSerializer.Deserialize(xml, this); 307 ScriptSerializer.Deserialize(xml, this);
310 308
@@ -956,8 +954,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
956 try 954 try
957 { 955 {
958 FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")); 956 FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state"));
959 System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); 957 Byte[] buf = (new UTF8Encoding()).GetBytes(xml);
960 Byte[] buf = enc.GetBytes(xml);
961 fs.Write(buf, 0, buf.Length); 958 fs.Write(buf, 0, buf.Length);
962 fs.Close(); 959 fs.Close();
963 } 960 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
index a3f848c..f247a0b 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs
@@ -58,9 +58,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
58// Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory); 58// Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);
59 m_xEngine = new XEngine(); 59 m_xEngine = new XEngine();
60 60
61 // Necessary to stop serialization complaining
62 WorldCommModule wcModule = new WorldCommModule();
63
64 IniConfigSource configSource = new IniConfigSource(); 61 IniConfigSource configSource = new IniConfigSource();
65 62
66 IConfig startupConfig = configSource.AddConfig("Startup"); 63 IConfig startupConfig = configSource.AddConfig("Startup");
@@ -68,13 +65,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests
68 65
69 IConfig xEngineConfig = configSource.AddConfig("XEngine"); 66 IConfig xEngineConfig = configSource.AddConfig("XEngine");
70 xEngineConfig.Set("Enabled", "true"); 67 xEngineConfig.Set("Enabled", "true");
68 xEngineConfig.Set("StartDelay", "0");
71 69
72 // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call 70 // These tests will not run with AppDomainLoading = true, at least on mono. For unknown reasons, the call
73 // to AssemblyResolver.OnAssemblyResolve fails. 71 // to AssemblyResolver.OnAssemblyResolve fails.
74 xEngineConfig.Set("AppDomainLoading", "false"); 72 xEngineConfig.Set("AppDomainLoading", "false");
75 73
76 m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource); 74 m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource);
77 SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule); 75 SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine);
78 m_scene.StartScripts(); 76 m_scene.StartScripts();
79 } 77 }
80 78
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index cc783aa..d763063 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -78,7 +78,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
78 private IConfigSource m_ConfigSource = null; 78 private IConfigSource m_ConfigSource = null;
79 private ICompiler m_Compiler; 79 private ICompiler m_Compiler;
80 private int m_MinThreads; 80 private int m_MinThreads;
81 private int m_MaxThreads ; 81 private int m_MaxThreads;
82
83 /// <summary>
84 /// Amount of time to delay before starting.
85 /// </summary>
86 private int m_StartDelay;
87
82 private int m_IdleTimeout; 88 private int m_IdleTimeout;
83 private int m_StackSize; 89 private int m_StackSize;
84 private int m_SleepTime; 90 private int m_SleepTime;
@@ -299,6 +305,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
299 m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100); 305 m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100);
300 m_IdleTimeout = m_ScriptConfig.GetInt("IdleTimeout", 60); 306 m_IdleTimeout = m_ScriptConfig.GetInt("IdleTimeout", 60);
301 string priority = m_ScriptConfig.GetString("Priority", "BelowNormal"); 307 string priority = m_ScriptConfig.GetString("Priority", "BelowNormal");
308 m_StartDelay = m_ScriptConfig.GetInt("StartDelay", 15000);
302 m_MaxScriptQueue = m_ScriptConfig.GetInt("MaxScriptEventQueue",300); 309 m_MaxScriptQueue = m_ScriptConfig.GetInt("MaxScriptEventQueue",300);
303 m_StackSize = m_ScriptConfig.GetInt("ThreadStackSize", 262144); 310 m_StackSize = m_ScriptConfig.GetInt("ThreadStackSize", 262144);
304 m_SleepTime = m_ScriptConfig.GetInt("MaintenanceInterval", 10) * 1000; 311 m_SleepTime = m_ScriptConfig.GetInt("MaintenanceInterval", 10) * 1000;
@@ -957,7 +964,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
957 { 964 {
958 // This delay exists to stop mono problems where script compilation and startup would stop the sim 965 // This delay exists to stop mono problems where script compilation and startup would stop the sim
959 // working properly for the session. 966 // working properly for the session.
960 System.Threading.Thread.Sleep(15000); 967 System.Threading.Thread.Sleep(m_StartDelay);
961 } 968 }
962 969
963 object[] o; 970 object[] o;
@@ -1768,12 +1775,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1768 1775
1769 public string GetXMLState(UUID itemID) 1776 public string GetXMLState(UUID itemID)
1770 { 1777 {
1771// m_log.DebugFormat("[XEngine]: Getting XML state for {0}", itemID); 1778// m_log.DebugFormat("[XEngine]: Getting XML state for script instance {0}", itemID);
1772 1779
1773 IScriptInstance instance = GetInstance(itemID); 1780 IScriptInstance instance = GetInstance(itemID);
1774 if (instance == null) 1781 if (instance == null)
1775 { 1782 {
1776// m_log.DebugFormat("[XEngine]: Found no script for {0}, returning empty string", itemID); 1783// m_log.DebugFormat("[XEngine]: Found no script instance for {0}, returning empty string", itemID);
1777 return ""; 1784 return "";
1778 } 1785 }
1779 1786
@@ -1848,7 +1855,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1848 tfs.Read(tdata, 0, tdata.Length); 1855 tfs.Read(tdata, 0, tdata.Length);
1849 } 1856 }
1850 1857
1851 assem = new System.Text.ASCIIEncoding().GetString(tdata); 1858 assem = Encoding.ASCII.GetString(tdata);
1852 } 1859 }
1853 catch (Exception e) 1860 catch (Exception e)
1854 { 1861 {