mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs OpenSim/Region/Framework/Scenes/Scene.cs
This commit is contained in:
@@ -114,6 +114,16 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||
UUID AssetID { get; }
|
||||
Queue EventQueue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of events queued for processing.
|
||||
/// </summary>
|
||||
long EventsQueued { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of events processed by this script instance.
|
||||
/// </summary>
|
||||
long EventsProcessed { get; }
|
||||
|
||||
void ClearQueue();
|
||||
int StartParam { get; set; }
|
||||
|
||||
|
||||
@@ -174,6 +174,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
|
||||
public Queue EventQueue { get; private set; }
|
||||
|
||||
public long EventsQueued
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (EventQueue)
|
||||
return EventQueue.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public long EventsProcessed { get; private set; }
|
||||
|
||||
public int StartParam { get; set; }
|
||||
|
||||
public TaskInventoryItem ScriptTask { get; private set; }
|
||||
@@ -776,6 +787,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
ChatTypeEnum.DebugChannel, 2147483647,
|
||||
part.AbsolutePosition,
|
||||
part.Name, part.UUID, false);
|
||||
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[SCRIPT INSTANCE]: Runtime error in script {0}, part {1} {2} at {3} in {4}, displayed error {5}, actual exception {6}",
|
||||
ScriptName,
|
||||
PrimName,
|
||||
part.UUID,
|
||||
part.AbsolutePosition,
|
||||
part.ParentGroup.Scene.Name,
|
||||
text.Replace("\n", "\\n"),
|
||||
e.InnerException);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -810,6 +832,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
// script engine to run the next event.
|
||||
lock (EventQueue)
|
||||
{
|
||||
EventsProcessed++;
|
||||
|
||||
if (EventQueue.Count > 0 && Running && !ShuttingDown)
|
||||
{
|
||||
m_CurrentWorkItem = Engine.QueueEventHandler(this);
|
||||
@@ -1015,7 +1039,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||
"({0}): {1}", scriptLine - 1,
|
||||
e.InnerException.Message);
|
||||
|
||||
System.Console.WriteLine(e.ToString()+"\n");
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
protected XEngine.XEngine m_engine;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
public override void SetUp()
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
IConfigSource initConfigSource = new IniConfigSource();
|
||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||
config.Set("Enabled", "true");
|
||||
|
||||
@@ -62,8 +62,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
protected XEngine.XEngine m_engine;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
public override void SetUp()
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
IConfigSource initConfigSource = new IniConfigSource();
|
||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||
config.Set("Enabled", "true");
|
||||
|
||||
@@ -51,8 +51,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
private LSL_Api m_lslApi;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
public override void SetUp()
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
IConfigSource initConfigSource = new IniConfigSource();
|
||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||
config.Set("Enabled", "true");
|
||||
|
||||
@@ -57,8 +57,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
protected XEngine.XEngine m_engine;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
public override void SetUp()
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
IConfigSource initConfigSource = new IniConfigSource();
|
||||
IConfig config = initConfigSource.AddConfig("XEngine");
|
||||
config.Set("Enabled", "true");
|
||||
|
||||
@@ -127,12 +127,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
OSSL_Api osslApi = new OSSL_Api();
|
||||
osslApi.Initialize(m_engine, so.RootPart, null);
|
||||
|
||||
string npcRaw;
|
||||
bool gotExpectedException = false;
|
||||
try
|
||||
{
|
||||
npcRaw
|
||||
= osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), "not existing notecard name");
|
||||
osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), "not existing notecard name");
|
||||
}
|
||||
catch (ScriptException)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics; //for [DebuggerNonUserCode]
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
using System.Security.Policy;
|
||||
@@ -445,8 +446,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
/// </summary>
|
||||
/// <param name="cmdparams"></param>
|
||||
/// <param name="instance"></param>
|
||||
/// <returns>true if we're okay to proceed, false if not.</returns>
|
||||
/// <param name="comparer">Basis on which to sort output. Can be null if no sort needs to take place</param>
|
||||
private void HandleScriptsAction(string[] cmdparams, Action<IScriptInstance> action)
|
||||
{
|
||||
HandleScriptsAction<object>(cmdparams, action, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse the raw item id into a script instance from the command params if it's present.
|
||||
/// </summary>
|
||||
/// <param name="cmdparams"></param>
|
||||
/// <param name="instance"></param>
|
||||
/// <param name="keySelector">Basis on which to sort output. Can be null if no sort needs to take place</param>
|
||||
private void HandleScriptsAction<TKey>(
|
||||
string[] cmdparams, Action<IScriptInstance> action, Func<IScriptInstance, TKey> keySelector)
|
||||
{
|
||||
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
|
||||
return;
|
||||
@@ -458,7 +471,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
|
||||
if (cmdparams.Length == 2)
|
||||
{
|
||||
foreach (IScriptInstance instance in m_Scripts.Values)
|
||||
IEnumerable<IScriptInstance> scripts = m_Scripts.Values;
|
||||
|
||||
if (keySelector != null)
|
||||
scripts = scripts.OrderBy<IScriptInstance, TKey>(keySelector);
|
||||
|
||||
foreach (IScriptInstance instance in scripts)
|
||||
action(instance);
|
||||
|
||||
return;
|
||||
@@ -505,9 +523,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName);
|
||||
|
||||
lock (m_Scripts)
|
||||
sb.AppendFormat("Scripts loaded : {0}\n", m_Scripts.Count);
|
||||
long scriptsLoaded, eventsQueued = 0, eventsProcessed = 0;
|
||||
|
||||
lock (m_Scripts)
|
||||
{
|
||||
scriptsLoaded = m_Scripts.Count;
|
||||
|
||||
foreach (IScriptInstance si in m_Scripts.Values)
|
||||
{
|
||||
eventsQueued += si.EventsQueued;
|
||||
eventsProcessed += si.EventsProcessed;
|
||||
}
|
||||
}
|
||||
|
||||
sb.AppendFormat("Scripts loaded : {0}\n", scriptsLoaded);
|
||||
sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count);
|
||||
sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count);
|
||||
sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads);
|
||||
@@ -516,6 +545,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads);
|
||||
sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks);
|
||||
// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count);
|
||||
sb.AppendFormat("Events queued : {0}\n", eventsQueued);
|
||||
sb.AppendFormat("Events processed : {0}\n", eventsProcessed);
|
||||
|
||||
SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this);
|
||||
sb.AppendFormat("Sensors : {0}\n", sr != null ? sr.SensorsCount : 0);
|
||||
@@ -546,7 +577,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
}
|
||||
}
|
||||
|
||||
HandleScriptsAction(cmdparams, HandleShowScript);
|
||||
HandleScriptsAction<long>(cmdparams, HandleShowScript, si => si.EventsProcessed);
|
||||
}
|
||||
|
||||
private void HandleShowScript(IScriptInstance instance)
|
||||
@@ -576,10 +607,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
|
||||
sb.AppendFormat("Script name : {0}\n", instance.ScriptName);
|
||||
sb.AppendFormat("Status : {0}\n", status);
|
||||
|
||||
lock (eq)
|
||||
sb.AppendFormat("Queued events : {0}\n", eq.Count);
|
||||
|
||||
sb.AppendFormat("Queued events : {0}\n", instance.EventsQueued);
|
||||
sb.AppendFormat("Processed events : {0}\n", instance.EventsProcessed);
|
||||
sb.AppendFormat("Item UUID : {0}\n", instance.ItemID);
|
||||
sb.AppendFormat("Containing part name: {0}\n", instance.PrimName);
|
||||
sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID);
|
||||
@@ -1089,8 +1118,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
|
||||
string assembly = "";
|
||||
|
||||
CultureInfo USCulture = new CultureInfo("en-US");
|
||||
Thread.CurrentThread.CurrentCulture = USCulture;
|
||||
Culture.SetCurrentCulture();
|
||||
|
||||
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
|
||||
|
||||
@@ -1504,8 +1532,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
/// <returns></returns>
|
||||
private object ProcessEventHandler(object parms)
|
||||
{
|
||||
CultureInfo USCulture = new CultureInfo("en-US");
|
||||
Thread.CurrentThread.CurrentCulture = USCulture;
|
||||
Culture.SetCurrentCulture();
|
||||
|
||||
IScriptInstance instance = (ScriptInstance) parms;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user