Moved prim crossing out of OGS1 and into RESTComms and LocalInterregionComms. This breaks interregion comms with older versions in what concerns prim crossing. In the process of moving the comms, a few things seem to be working better, namely this may address mantis #3011, mantis #1698. Hopefully, this doesn't break anything else. But I'm still seeing weirdnesses with attchments jumping out of place after a cross/TP.

The two most notable changes in the crossing process were:
* Object gets passed in only one message, not two as done before.
* Local object crossings do not get serialized, as done before.
This commit is contained in:
diva
2009-02-09 22:27:27 +00:00
parent 29f54db90a
commit 2c685bff14
10 changed files with 546 additions and 111 deletions

View File

@@ -309,6 +309,8 @@ namespace OpenSim.Region.Framework.Scenes
public string GetStateSnapshot()
{
Console.WriteLine(" >>> GetStateSnapshot <<<");
List<string> assemblies = new List<string>();
Dictionary<UUID, string> states = new Dictionary<UUID, string>();
@@ -358,9 +360,16 @@ namespace OpenSim.Region.Framework.Scenes
Byte[] data = new Byte[fi.Length];
FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read);
fs.Read(data, 0, data.Length);
fs.Close();
try
{
FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read);
fs.Read(data, 0, data.Length);
fs.Close();
}
catch (Exception e)
{
m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message);
}
XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", "");
XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", "");
@@ -397,5 +406,73 @@ namespace OpenSim.Region.Framework.Scenes
return xmldoc.InnerXml;
}
public void SetState(string objXMLData, UUID RegionID)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(objXMLData);
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
if (rootL.Count == 1)
{
XmlNode rootNode = rootL[0];
if (rootNode != null)
{
XmlNodeList partL = rootNode.ChildNodes;
foreach (XmlNode part in partL)
{
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();
}
}
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;
}
}
}
}
}
}
}