From cf3ffe5bb4c6a8bea9599b6143c2f7793500c984 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 24 Aug 2011 20:49:23 +0100
Subject: Fix llAttachToAvatar()
Apart from one obvious bug, this was failing because attempting to serialize the script from inside the script (as part of saving the attachment as an inventory asset) was triggering an extremely long delay.
So we now don't do this. The state will be serialized anyway when the avatar normally logs out.
The worst that can happen is that if the client/server crashes, the attachment scripts start without previous state.
---
OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | 11 +++++++++++
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++--
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 9 +++++++++
3 files changed, 22 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine')
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index 8b7871b..0cc0fe7 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -58,7 +58,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
///
public interface IScriptInstance
{
+ ///
+ /// Is this script currently running?
+ ///
bool Running { get; set; }
+
bool ShuttingDown { get; set; }
string State { get; set; }
IScriptEngine Engine { get; }
@@ -78,7 +82,14 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void Init();
void Start();
+
+ ///
+ /// Stop the script.
+ ///
+ ///
+ /// true if the script was successfully stopped, false otherwise
bool Stop(int timeout);
+
void SetState(string state);
void PostEvent(EventParams data);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ffa0e24..d340ef2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2964,8 +2964,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
- if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
- return;
+// if (m_host.ParentGroup.RootPart.AttachmentPoint == 0)
+// return;
TaskInventoryItem item;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index d253c6a..c443669 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1294,9 +1294,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public string GetXMLState(UUID itemID)
{
+// m_log.DebugFormat("[XEngine]: Getting XML state for {0}", itemID);
+
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
+ {
+// m_log.DebugFormat("[XEngine]: Found no script for {0}, returning empty string", itemID);
return "";
+ }
+
string xml = instance.GetXMLState();
XmlDocument sdoc = new XmlDocument();
@@ -1437,6 +1443,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
mapData.InnerText = map;
stateData.AppendChild(mapData);
+
+// m_log.DebugFormat("[XEngine]: Got XML state for {0}", itemID);
+
return doc.InnerXml;
}
--
cgit v1.1