Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
	OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
	OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
This commit is contained in:
Melanie
2012-06-26 17:35:55 +01:00
17 changed files with 245 additions and 143 deletions

View File

@@ -63,6 +63,16 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
/// </summary>
bool Running { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this
/// <see cref="OpenSim.Region.ScriptEngine.Interfaces.IScriptInstance"/> is run.
/// For viewer script editor control
/// </summary>
/// <value>
/// <c>true</c> if run; otherwise, <c>false</c>.
/// </value>
bool Run { get; set; }
/// <summary>
/// Is the script suspended?
/// </summary>

View File

@@ -121,6 +121,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public bool Running { get; set; }
public bool Run { get; set; }
public bool Suspended
{
get { return m_Suspended; }
@@ -216,6 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_postOnRez = postOnRez;
m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
Run = true;
if (part != null)
{
@@ -330,16 +333,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
else
{
m_log.ErrorFormat(
"[SCRIPT INSTANCE]: Unable to load script state from assembly {0}: Memory limit exceeded",
assembly);
m_log.WarnFormat(
"[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). Memory limit exceeded",
savedState, ScriptName, ItemID, PrimName, ObjectID, assembly);
}
}
catch (Exception e)
{
m_log.ErrorFormat(
"[SCRIPT INSTANCE]: Unable to load script state from assembly {0}. XML is {1}. Exception {2}{3}",
assembly, xml, e.Message, e.StackTrace);
"[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). XML is {6}. Exception {7}{8}",
savedState, ScriptName, ItemID, PrimName, ObjectID, assembly, xml, e.Message, e.StackTrace);
}
}
// else
@@ -354,10 +357,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void Init()
{
if (!m_startOnInit) return;
if (!m_startOnInit)
return;
if (m_startedFromSavedState)
{
if (!Run)
return;
Start();
if (m_postOnRez)
{
@@ -390,6 +397,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
else
{
if (!Run)
return;
Start();
PostEvent(new EventParams("state_entry",
new Object[0], new DetectParams[0]));

View File

@@ -55,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public static string Serialize(ScriptInstance instance)
{
bool running = instance.Running;
bool enabled = instance.Run;
XmlDocument xmldoc = new XmlDocument();
@@ -77,6 +78,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
rootElement.AppendChild(run);
XmlElement run_enable = xmldoc.CreateElement("", "Run", "");
run_enable.AppendChild(xmldoc.CreateTextNode(
enabled.ToString()));
rootElement.AppendChild(run_enable);
Dictionary<string, Object> vars = instance.GetVars();
XmlElement variables = xmldoc.CreateElement("", "Variables", "");
@@ -225,6 +232,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
object varValue;
XmlNodeList partL = rootNode.ChildNodes;
instance.Run = true;
foreach (XmlNode part in partL)
{
@@ -236,6 +244,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
case "Running":
instance.Running=bool.Parse(part.InnerText);
break;
case "Run":
instance.Run = bool.Parse(part.InnerText);
break;
case "Variables":
XmlNodeList varL = part.ChildNodes;
foreach (XmlNode var in varL)

View File

@@ -920,15 +920,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
if (m_InitialStartup)
{
m_InitialStartup = false;
// This delay exists to stop mono problems where script compilation and startup would stop the sim
// working properly for the session.
System.Threading.Thread.Sleep(15000);
if (m_CompileQueue.Count == 0)
{
// No scripts on region, so won't get triggered later
// by the queue becoming empty so we trigger it here
m_Scene.EventManager.TriggerEmptyScriptCompileQueue(0, String.Empty);
}
}
object[] o;
@@ -941,14 +935,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
scriptsStarted++;
// if (scriptsStarted % 50 == 0)
// m_log.DebugFormat(
// "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
if (m_InitialStartup)
if (scriptsStarted % 50 == 0)
m_log.InfoFormat(
"[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
}
}
// m_log.DebugFormat(
// "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
if (m_InitialStartup)
m_log.InfoFormat(
"[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
// NOTE: Despite having a lockless queue, this lock is required
// to make sure there is never no compile thread while there
@@ -956,12 +952,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// due to a race condition
//
lock (m_CompileQueue)
{
m_CurrentCompile = null;
}
m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount,
m_ScriptErrorMessage);
m_ScriptFailCount = 0;
m_InitialStartup = false;
return null;
}
@@ -1451,24 +1448,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
uuids = m_PrimObjects[localID];
foreach (UUID itemID in uuids)
{
IScriptInstance instance = null;
try
foreach (UUID itemID in uuids)
{
if (m_Scripts.ContainsKey(itemID))
instance = m_Scripts[itemID];
IScriptInstance instance = null;
try
{
if (m_Scripts.ContainsKey(itemID))
instance = m_Scripts[itemID];
}
catch { /* ignore race conditions */ }
if (instance != null)
{
instance.PostEvent(p);
result = true;
}
}
catch { /* ignore race conditions */ }
if (instance != null)
{
instance.PostEvent(p);
result = true;
}
}
}
return result;
@@ -1594,6 +1590,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
}
public void SetRunEnable(UUID instanceID, bool enable)
{
IScriptInstance instance = GetInstance(instanceID);
if (instance != null)
instance.Run = enable;
}
public bool GetScriptState(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);