Avoid writing script state to the filesystem if the state has not changed.
Remove the unneccessary double check that was only used to provide a meaningless warning message for a corner case.0.6.5-rc1
parent
c8aaf538e4
commit
fcab3510b3
|
@ -92,6 +92,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
private StateSource m_stateSource;
|
private StateSource m_stateSource;
|
||||||
private bool m_postOnRez;
|
private bool m_postOnRez;
|
||||||
private bool m_startedFromSavedState = false;
|
private bool m_startedFromSavedState = false;
|
||||||
|
private string m_CurrentState = String.Empty;
|
||||||
|
|
||||||
//private ISponsor m_ScriptSponsor;
|
//private ISponsor m_ScriptSponsor;
|
||||||
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
|
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
|
||||||
|
@ -870,21 +871,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
|
||||||
|
|
||||||
string xml = ScriptSerializer.Serialize(this);
|
string xml = ScriptSerializer.Serialize(this);
|
||||||
|
|
||||||
try
|
if (m_CurrentState != xml)
|
||||||
{
|
{
|
||||||
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"));
|
try
|
||||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
{
|
||||||
Byte[] buf = enc.GetBytes(xml);
|
FileStream fs = File.Create(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state"));
|
||||||
fs.Write(buf, 0, buf.Length);
|
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||||
fs.Close();
|
Byte[] buf = enc.GetBytes(xml);
|
||||||
}
|
fs.Write(buf, 0, buf.Length);
|
||||||
catch(Exception e)
|
fs.Close();
|
||||||
{
|
}
|
||||||
m_log.Error("Unable to save xml\n"+e.ToString());
|
catch(Exception e)
|
||||||
}
|
{
|
||||||
if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")))
|
m_log.Error("Unable to save xml\n"+e.ToString());
|
||||||
{
|
}
|
||||||
throw new Exception("Completed persistence save, but no file was created");
|
//if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), m_ItemID.ToString() + ".state")))
|
||||||
|
//{
|
||||||
|
// throw new Exception("Completed persistence save, but no file was created");
|
||||||
|
//}
|
||||||
|
m_CurrentState = xml;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue