* Misc. formatting cleanup for the previous patch

* Added the new AppDomainLoading variable to the [XEngine] section in the example config
0.6.8-post-fixes
John Hurliman 2009-10-29 05:56:37 -07:00
parent 33448e4ba8
commit dd13fa361b
4 changed files with 47 additions and 37 deletions

View File

@ -174,8 +174,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
else
{
#if DEBUG
// m_log.Debug("[Compiler]: " +
// "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language.");
// m_log.Debug("[Compiler]: " +
// "Config OK. Default language \"" + defaultCompileLanguage + "\" specified in \"DefaultCompileLanguage\" is recognized as a valid language.");
#endif
// LANGUAGE IS IN ALLOW-LIST
DefaultCompileLanguage = LanguageMapping[defaultCompileLanguage];
@ -214,12 +214,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
catch (Exception ex)
{
m_log.Error("[Compiler]: Exception trying to create ScriptEngine directory \"" + Path.Combine(ScriptEnginesPath,
m_scriptEngine.World.RegionInfo.RegionID.ToString())+ "\": " + ex.ToString());
m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString());
}
}
foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath,
m_scriptEngine.World.RegionInfo.RegionID.ToString()),FilePrefix + "_compiled*"))
m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*"))
{
try
{
@ -274,7 +274,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
/// <param name="Script">LSL script</param>
/// <returns>Filename to .dll assembly</returns>
public void PerformScriptCompile(string Script, string asset, UUID ownerUUID,
out string assembly, out Dictionary<KeyValuePair<int,int>, KeyValuePair<int,int>> linemap)
out string assembly, out Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap)
{
linemap = null;
m_warnings.Clear();
@ -352,7 +352,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
throw new Exception(errtext);
}
if (m_scriptEngine.World.Permissions.CanCompileScript(ownerUUID, (int)language) == false) {
if (m_scriptEngine.World.Permissions.CanCompileScript(ownerUUID, (int)language) == false)
{
// Not allowed to compile to this language!
string errtext = String.Empty;
errtext += ownerUUID + " is not in list of allowed users for this scripting language. Script will not be executed!";
@ -373,7 +374,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
AddWarning(warning);
}
linemap = ((CSCodeGenerator) LSL_Converter).PositionMap;
linemap = ((CSCodeGenerator)LSL_Converter).PositionMap;
// Write the linemap to a file and save it in our dictionary for next time.
m_lineMaps[assembly] = linemap;
WriteMapFile(assembly + ".map", linemap);
@ -487,7 +488,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
}
catch (Exception e) // NOTLEGIT - Should be just FileIOException
{
throw new Exception("Unable to delete old existing "+
throw new Exception("Unable to delete old existing " +
"script-file before writing new. Compile aborted: " +
e.ToString());
}
@ -506,7 +507,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
}
catch (Exception ex) //NOTLEGIT - Should be just FileIOException
{
m_log.Error("[Compiler]: Exception while "+
m_log.Error("[Compiler]: Exception while " +
"trying to write script source to file \"" +
srcFileName + "\": " + ex.ToString());
}
@ -547,7 +548,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
case enumCompileType.cs:
case enumCompileType.lsl:
bool complete = false;
bool retried = false;
bool retried = false;
do
{
lock (CScodeProvider)
@ -588,7 +589,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
parameters, Script);
break;
default:
throw new Exception("Compiler is not able to recongnize "+
throw new Exception("Compiler is not able to recongnize " +
"language type \"" + lang.ToString() + "\"");
}
@ -641,7 +642,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
if (!File.Exists(assembly))
{
for (int i=0; i<20 && !File.Exists(assembly); i++)
for (int i = 0; i < 20 && !File.Exists(assembly); i++)
{
System.Threading.Thread.Sleep(250);
}
@ -654,8 +655,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
}
}
// m_log.DebugFormat("[Compiler] Compiled new assembly "+
// "for {0}", asset);
// m_log.DebugFormat("[Compiler] Compiled new assembly "+
// "for {0}", asset);
// Because windows likes to perform exclusive locks, we simply
// write out a textual representation of the file here
@ -694,17 +695,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
Byte[] buf = enc.GetBytes(filetext);
FileStream sfs = File.Create(assembly+".text");
FileStream sfs = File.Create(assembly + ".text");
sfs.Write(buf, 0, buf.Length);
sfs.Close();
return assembly;
}
private class kvpSorter : IComparer<KeyValuePair<int,int>>
private class kvpSorter : IComparer<KeyValuePair<int, int>>
{
public int Compare(KeyValuePair<int,int> a,
KeyValuePair<int,int> b)
public int Compare(KeyValuePair<int, int> a,
KeyValuePair<int, int> b)
{
return a.Key.CompareTo(b.Key);
}
@ -723,8 +724,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
out ret))
return ret;
List<KeyValuePair<int,int>> sorted =
new List<KeyValuePair<int,int>>(positionMap.Keys);
List<KeyValuePair<int, int>> sorted =
new List<KeyValuePair<int, int>>(positionMap.Keys);
sorted.Sort(new kvpSorter());
@ -791,7 +792,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
}
private static Dictionary<KeyValuePair<int,int>, KeyValuePair<int,int>> ReadMapFile(string filename)
private static Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> ReadMapFile(string filename)
{
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
try
@ -802,7 +803,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
string line;
while ((line = r.ReadLine()) != null)
{
String[] parts = line.Split(new Char[] {','});
String[] parts = line.Split(new Char[] { ',' });
int kk = System.Convert.ToInt32(parts[0]);
int kv = System.Convert.ToInt32(parts[1]);
int vk = System.Convert.ToInt32(parts[2]);

View File

@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private StateSource m_stateSource;
private bool m_postOnRez;
private bool m_startedFromSavedState = false;
private int m_CurrentStateHash;
private UUID m_CurrentStateHash;
private UUID m_RegionID = UUID.Zero;
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
@ -901,7 +901,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// Compare hash of the state we just just created with the state last written to disk
// If the state is different, update the disk file.
if(xml.GetHashCode() != m_CurrentStateHash)
UUID hash = UUID.Parse(Utils.MD5String(xml));
if(hash != m_CurrentStateHash)
{
try
{
@ -919,7 +921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
//{
// throw new Exception("Completed persistence save, but no file was created");
//}
m_CurrentStateHash = xml.GetHashCode();
m_CurrentStateHash = hash;
}
}

View File

@ -710,15 +710,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
evidence, appSetup);
else
sandbox = AppDomain.CurrentDomain;
/*
PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet);
CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement);
sandboxPolicy.RootCodeGroup = sandboxCodeGroup;
sandbox.SetAppDomainPolicy(sandboxPolicy);
*/
//PolicyLevel sandboxPolicy = PolicyLevel.CreateAppDomainLevel();
//AllMembershipCondition sandboxMembershipCondition = new AllMembershipCondition();
//PermissionSet sandboxPermissionSet = sandboxPolicy.GetNamedPermissionSet("Internet");
//PolicyStatement sandboxPolicyStatement = new PolicyStatement(sandboxPermissionSet);
//CodeGroup sandboxCodeGroup = new UnionCodeGroup(sandboxMembershipCondition, sandboxPolicyStatement);
//sandboxPolicy.RootCodeGroup = sandboxCodeGroup;
//sandbox.SetAppDomainPolicy(sandboxPolicy);
m_AppDomains[appDomain] = sandbox;
m_AppDomains[appDomain].AssemblyResolve +=

View File

@ -941,6 +941,13 @@
; Stack size per thread created
ThreadStackSize = 262144
; Set this to true (the default) to load each script into a separate
; AppDomain. Setting this to false will load all script assemblies into the
; current AppDomain, which will reduce the per-script overhead at the
; expense of reduced security and the inability to garbage collect the
; script assemblies
AppDomainLoading = true
; Rate to poll for asynchronous command replies (ms)
; currently unused
;AsyncLLCommandLoopms = 50