Remove the old (Remoting) region crossing code. Fix the new code to
pass script state and assembly again properly. Reintroduce respecting tht TrustBinaries flag. Changes the interregion protocol! No version bump because it was broken anyway, so with a version mismatch it will simply stay broken, but not crash. Region corssing still doesn't work because there is still monkey business with both rezzed prims being pushed across a border and attached prims when walking across a border. Teleport is untested by may work.mysql-performance
parent
05fc504ff3
commit
9d63f90467
|
@ -38,6 +38,6 @@ namespace OpenSim.Framework
|
||||||
string ExtraToXmlString();
|
string ExtraToXmlString();
|
||||||
void ExtraFromXmlString(string xmlstr);
|
void ExtraFromXmlString(string xmlstr);
|
||||||
string GetStateSnapshot();
|
string GetStateSnapshot();
|
||||||
void SetState(string xmlstr, UUID regionID);
|
void SetState(string xmlstr, IScene s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,8 +263,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
{
|
{
|
||||||
// We need to make a local copy of the object
|
// We need to make a local copy of the object
|
||||||
ISceneObject sogClone = sog.CloneForNewScene();
|
ISceneObject sogClone = sog.CloneForNewScene();
|
||||||
sogClone.SetState(sog.GetStateSnapshot(),
|
sogClone.SetState(sog.GetStateSnapshot(), s);
|
||||||
s.RegionInfo.RegionID);
|
|
||||||
return s.IncomingCreateObject(sogClone);
|
return s.IncomingCreateObject(sogClone);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -294,15 +293,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
|
|
||||||
#region Misc
|
#region Misc
|
||||||
|
|
||||||
public UUID GetRegionID(ulong regionhandle)
|
public Scene GetScene(ulong regionhandle)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_sceneList)
|
foreach (Scene s in m_sceneList)
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == regionhandle)
|
if (s.RegionInfo.RegionHandle == regionhandle)
|
||||||
return s.RegionInfo.RegionID;
|
return s;
|
||||||
}
|
}
|
||||||
// ? weird. should not happen
|
// ? weird. should not happen
|
||||||
return m_sceneList[0].RegionInfo.RegionID;
|
return m_sceneList[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLocalRegion(ulong regionhandle)
|
public bool IsLocalRegion(ulong regionhandle)
|
||||||
|
|
|
@ -641,7 +641,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
if (args["extra"] != null)
|
if (args["extra"] != null)
|
||||||
extraStr = args["extra"].AsString();
|
extraStr = args["extra"].AsString();
|
||||||
|
|
||||||
UUID regionID = m_localBackend.GetRegionID(regionhandle);
|
IScene s = m_localBackend.GetScene(regionhandle);
|
||||||
SceneObjectGroup sog = null;
|
SceneObjectGroup sog = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -663,7 +663,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sog.SetState(stateXmlStr, regionID);
|
sog.SetState(stateXmlStr, s);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -695,8 +695,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
|
||||||
if (args["itemid"] != null)
|
if (args["itemid"] != null)
|
||||||
itemID = args["itemid"].AsUUID();
|
itemID = args["itemid"].AsUUID();
|
||||||
|
|
||||||
//UUID regionID = m_localBackend.GetRegionID(regionhandle);
|
|
||||||
|
|
||||||
// This is the meaning of PUT object
|
// This is the meaning of PUT object
|
||||||
bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID);
|
bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID);
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,5 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// A <see cref="Dictionary`2"/>
|
/// A <see cref="Dictionary`2"/>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
Dictionary<UUID, string> GetScriptStates();
|
Dictionary<UUID, string> GetScriptStates();
|
||||||
|
|
||||||
bool CanBeDeleted();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
string ScriptEngineName { get; }
|
string ScriptEngineName { get; }
|
||||||
|
|
||||||
string GetXMLState(UUID itemID);
|
string GetXMLState(UUID itemID);
|
||||||
bool CanBeDeleted(UUID itemID);
|
void SetXMLState(UUID itemID, string xml);
|
||||||
|
|
||||||
bool PostScriptEvent(UUID itemID, string name, Object[] args);
|
bool PostScriptEvent(UUID itemID, string name, Object[] args);
|
||||||
bool PostObjectEvent(UUID itemID, string name, Object[] args);
|
bool PostObjectEvent(UUID itemID, string name, Object[] args);
|
||||||
|
|
|
@ -131,11 +131,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (left > 0)
|
if (left > 0)
|
||||||
{
|
{
|
||||||
x = m_inventoryDeletes.Dequeue();
|
x = m_inventoryDeletes.Dequeue();
|
||||||
if (!x.objectGroup.CanBeDeleted())
|
|
||||||
{
|
|
||||||
m_inventoryDeletes.Enqueue(x);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
|
"[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
|
||||||
|
|
|
@ -618,7 +618,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
|
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
|
||||||
m_persistAfter *= 10000000;
|
m_persistAfter *= 10000000;
|
||||||
|
|
||||||
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine");
|
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
|
||||||
|
|
||||||
IConfig packetConfig = m_config.Configs["PacketPool"];
|
IConfig packetConfig = m_config.Configs["PacketPool"];
|
||||||
if (packetConfig != null)
|
if (packetConfig != null)
|
||||||
|
|
|
@ -351,12 +351,29 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return xmldoc.InnerXml;
|
return xmldoc.InnerXml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetState(string objXMLData, UUID RegionID)
|
public void SetState(string objXMLData, IScene ins)
|
||||||
{
|
{
|
||||||
m_log.Debug("SetState called with " + objXMLData);
|
if (!(ins is Scene))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Scene s = (Scene)ins;
|
||||||
|
|
||||||
if (objXMLData == String.Empty)
|
if (objXMLData == String.Empty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
IScriptModule scriptModule = null;
|
||||||
|
|
||||||
|
foreach (IScriptModule sm in s.RequestModuleInterfaces<IScriptModule>())
|
||||||
|
{
|
||||||
|
if (sm.ScriptEngineName == s.DefaultScriptEngine)
|
||||||
|
scriptModule = sm;
|
||||||
|
else if (scriptModule == null)
|
||||||
|
scriptModule = sm;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scriptModule == null)
|
||||||
|
return;
|
||||||
|
|
||||||
XmlDocument doc = new XmlDocument();
|
XmlDocument doc = new XmlDocument();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -374,69 +391,23 @@ m_log.Debug("SetState called with " + objXMLData);
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
|
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
|
||||||
if (rootL.Count == 1)
|
if (rootL.Count != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement rootE = (XmlElement)rootL[0];
|
||||||
|
|
||||||
|
XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates");
|
||||||
|
if (dataL.Count != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement dataE = (XmlElement)dataL[0];
|
||||||
|
|
||||||
|
foreach (XmlNode n in dataE.ChildNodes)
|
||||||
{
|
{
|
||||||
XmlNode rootNode = rootL[0];
|
XmlElement stateE = (XmlElement)n;
|
||||||
if (rootNode != null)
|
UUID itemID = new UUID(stateE.GetAttribute("UUID"));
|
||||||
{
|
|
||||||
XmlNodeList partL = rootNode.ChildNodes;
|
|
||||||
|
|
||||||
foreach (XmlNode part in partL)
|
scriptModule.SetXMLState(itemID, n.OuterXml);
|
||||||
{
|
|
||||||
XmlNodeList nodeL = part.ChildNodes;
|
|
||||||
|
|
||||||
switch (part.Name)
|
|
||||||
{
|
|
||||||
case "Assemblies":
|
|
||||||
foreach (XmlNode asm in nodeL)
|
|
||||||
{
|
|
||||||
string fn = asm.Attributes.GetNamedItem("Filename").Value;
|
|
||||||
|
|
||||||
Byte[] filedata = Convert.FromBase64String(asm.InnerText);
|
|
||||||
string path = Path.Combine("ScriptEngines", RegionID.ToString());
|
|
||||||
path = Path.Combine(path, fn);
|
|
||||||
|
|
||||||
if (!File.Exists(path))
|
|
||||||
{
|
|
||||||
FileStream fs = File.Create(path);
|
|
||||||
fs.Write(filedata, 0, filedata.Length);
|
|
||||||
fs.Close();
|
|
||||||
|
|
||||||
Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText);
|
|
||||||
fs = File.Create(path+".text");
|
|
||||||
fs.Write(textbytes, 0, textbytes.Length);
|
|
||||||
fs.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "ScriptStates":
|
|
||||||
foreach (XmlNode st in nodeL)
|
|
||||||
{
|
|
||||||
string id = st.Attributes.GetNamedItem("UUID").Value;
|
|
||||||
UUID uuid = new UUID(id);
|
|
||||||
XmlNode state = st.ChildNodes[0];
|
|
||||||
|
|
||||||
XmlDocument sdoc = new XmlDocument();
|
|
||||||
XmlNode sxmlnode = sdoc.CreateNode(
|
|
||||||
XmlNodeType.XmlDeclaration,
|
|
||||||
"", "");
|
|
||||||
sdoc.AppendChild(sxmlnode);
|
|
||||||
|
|
||||||
XmlNode newnode = sdoc.ImportNode(state, true);
|
|
||||||
sdoc.AppendChild(newnode);
|
|
||||||
|
|
||||||
string spath = Path.Combine("ScriptEngines", RegionID.ToString());
|
|
||||||
spath = Path.Combine(spath, uuid.ToString());
|
|
||||||
FileStream sfs = File.Create(spath + ".state");
|
|
||||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
|
||||||
Byte[] buf = enc.GetBytes(sdoc.InnerXml);
|
|
||||||
sfs.Write(buf, 0, buf.Length);
|
|
||||||
sfs.Close();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3341,17 +3341,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public bool CanBeDeleted()
|
|
||||||
{
|
|
||||||
foreach (SceneObjectPart part in Children.Values)
|
|
||||||
{
|
|
||||||
if (!part.CanBeDeleted())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GetUpdatePriority(IClientAPI client)
|
public double GetUpdatePriority(IClientAPI client)
|
||||||
{
|
{
|
||||||
switch (Scene.UpdatePrioritizationScheme)
|
switch (Scene.UpdatePrioritizationScheme)
|
||||||
|
|
|
@ -3797,10 +3797,5 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Inventory.ApplyNextOwnerPermissions();
|
Inventory.ApplyNextOwnerPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBeDeleted()
|
|
||||||
{
|
|
||||||
return Inventory.CanBeDeleted();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -886,30 +886,5 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBeDeleted()
|
|
||||||
{
|
|
||||||
if (!ContainsScripts())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
|
|
||||||
|
|
||||||
if (engines == null) // No engine at all
|
|
||||||
return true;
|
|
||||||
|
|
||||||
foreach (TaskInventoryItem item in m_items.Values)
|
|
||||||
{
|
|
||||||
if (item.InvType == (int)InventoryType.LSL)
|
|
||||||
{
|
|
||||||
foreach (IScriptModule e in engines)
|
|
||||||
{
|
|
||||||
if (!e.CanBeDeleted(item.ItemID))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
|
||||||
UUID GetDetectID(int idx);
|
UUID GetDetectID(int idx);
|
||||||
void SaveState(string assembly);
|
void SaveState(string assembly);
|
||||||
void DestroyScriptInstance();
|
void DestroyScriptInstance();
|
||||||
bool CanBeDeleted();
|
|
||||||
|
|
||||||
IScriptApi GetApi(string name);
|
IScriptApi GetApi(string name);
|
||||||
|
|
||||||
|
|
|
@ -1011,10 +1011,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
{
|
{
|
||||||
get { return m_RegionID; }
|
get { return m_RegionID; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBeDeleted()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1325,6 +1325,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string map = String.Empty;
|
||||||
|
|
||||||
|
if (File.Exists(fn + ".map"))
|
||||||
|
{
|
||||||
|
FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read);
|
||||||
|
StreamReader msr = new StreamReader(mfs);
|
||||||
|
|
||||||
|
map = msr.ReadToEnd();
|
||||||
|
|
||||||
|
msr.Close();
|
||||||
|
mfs.Close();
|
||||||
|
}
|
||||||
|
|
||||||
XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
|
XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
|
||||||
XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
|
XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
|
||||||
|
|
||||||
|
@ -1335,21 +1348,116 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
|
|
||||||
stateData.AppendChild(assemblyData);
|
stateData.AppendChild(assemblyData);
|
||||||
|
|
||||||
|
XmlElement mapData = doc.CreateElement("", "LineMap", "");
|
||||||
|
XmlAttribute mapName = doc.CreateAttribute("", "Filename", "");
|
||||||
|
|
||||||
|
mapName.Value = fn + ".map";
|
||||||
|
mapData.Attributes.Append(mapName);
|
||||||
|
|
||||||
|
mapData.InnerText = map;
|
||||||
|
|
||||||
|
stateData.AppendChild(mapData);
|
||||||
return doc.InnerXml;
|
return doc.InnerXml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanBeDeleted(UUID itemID)
|
|
||||||
{
|
|
||||||
IScriptInstance instance = GetInstance(itemID);
|
|
||||||
if (instance == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return instance.CanBeDeleted();
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled)
|
private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetXMLState(UUID itemID, string xml)
|
||||||
|
{
|
||||||
|
if (xml == String.Empty)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
doc.LoadXml(xml);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Error("[XEngine]: Exception decoding XML data from region transfer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlNodeList rootL = doc.GetElementsByTagName("State");
|
||||||
|
if (rootL.Count < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement rootE = (XmlElement)rootL[0];
|
||||||
|
|
||||||
|
if (rootE.GetAttribute("UUID") != itemID.ToString())
|
||||||
|
return;
|
||||||
|
|
||||||
|
string assetID = rootE.GetAttribute("Asset");
|
||||||
|
|
||||||
|
XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState");
|
||||||
|
|
||||||
|
if (stateL.Count != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement stateE = (XmlElement)stateL[0];
|
||||||
|
|
||||||
|
if (World.m_trustBinaries)
|
||||||
|
{
|
||||||
|
XmlNodeList assemL = rootE.GetElementsByTagName("Assembly");
|
||||||
|
|
||||||
|
if (assemL.Count != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XmlElement assemE = (XmlElement)assemL[0];
|
||||||
|
|
||||||
|
string fn = assemE.GetAttribute("Filename");
|
||||||
|
string base64 = assemE.InnerText;
|
||||||
|
|
||||||
|
string path = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
|
||||||
|
path = Path.Combine(path, fn);
|
||||||
|
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
Byte[] filedata = Convert.FromBase64String(base64);
|
||||||
|
|
||||||
|
FileStream fs = File.Create(path);
|
||||||
|
fs.Write(filedata, 0, filedata.Length);
|
||||||
|
fs.Close();
|
||||||
|
|
||||||
|
fs = File.Create(path + ".text");
|
||||||
|
StreamWriter sw = new StreamWriter(fs);
|
||||||
|
|
||||||
|
sw.Write(base64);
|
||||||
|
|
||||||
|
sw.Close();
|
||||||
|
fs.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
|
||||||
|
statepath = Path.Combine(statepath, itemID.ToString() + ".state");
|
||||||
|
|
||||||
|
FileStream sfs = File.Create(statepath);
|
||||||
|
StreamWriter ssw = new StreamWriter(sfs);
|
||||||
|
|
||||||
|
ssw.Write(stateE.OuterXml);
|
||||||
|
|
||||||
|
ssw.Close();
|
||||||
|
sfs.Close();
|
||||||
|
|
||||||
|
XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
|
||||||
|
|
||||||
|
XmlElement mapE = (XmlElement)mapL[0];
|
||||||
|
|
||||||
|
string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
|
||||||
|
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
|
||||||
|
|
||||||
|
FileStream mfs = File.Create(mappath);
|
||||||
|
StreamWriter msw = new StreamWriter(sfs);
|
||||||
|
|
||||||
|
msw.Write(mapE.InnerText);
|
||||||
|
|
||||||
|
msw.Close();
|
||||||
|
mfs.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue