minor cleanup

0.9.0-post-fixes
UbitUmarov 2017-05-27 05:41:40 +01:00
parent 2be362bd67
commit 289d4ca128
3 changed files with 56 additions and 86 deletions

View File

@ -429,6 +429,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
if(byuuid != null) if(byuuid != null)
byuuid.Remove(r.RegionID); byuuid.Remove(r.RegionID);
removeFromInner(r); removeFromInner(r);
storage[handle] = null;
} }
storage.Remove(handle); storage.Remove(handle);
} }
@ -586,27 +587,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
{ {
if(expires == null || expires.Count == 0) if(expires == null || expires.Count == 0)
return 0; return 0;
int expiresCount = expires.Count;
List<ulong> toexpire = new List<ulong>(); List<ulong> toexpire = new List<ulong>();
foreach(KeyValuePair<ulong, DateTime> kvp in expires) foreach(KeyValuePair<ulong, DateTime> kvp in expires)
{ {
if(kvp.Value < now) if(kvp.Value < now)
toexpire.Add(kvp.Key); toexpire.Add(kvp.Key);
} }
if(toexpire.Count == 0) int toexpireCount = toexpire.Count;
return expires.Count; if(toexpireCount == 0)
return expiresCount;
if(toexpire.Count == expires.Count) if(toexpireCount == expiresCount)
{ {
Clear(); Clear();
return 0; return 0;
} }
foreach(ulong h in toexpire) if(storage != null)
{ {
if(storage != null) ulong h;
for(int i = 0; i < toexpireCount; i++)
{ {
h = toexpire[i];
if(storage.ContainsKey(h)) if(storage.ContainsKey(h))
{ {
GridRegion r = storage[h]; GridRegion r = storage[h];
@ -619,12 +625,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
storage[h] = null; storage[h] = null;
storage.Remove(h); storage.Remove(h);
} }
if(expires != null)
expires.Remove(h);
} }
if(expires != null) }
expires.Remove(h); else
{
Clear();
return 0;
} }
if(expires.Count == 0) if(expiresCount == 0)
{ {
byname = null; byname = null;
byuuid = null; byuuid = null;
@ -633,7 +644,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return 0; return 0;
} }
return expires.Count; return expiresCount;
} }
public int Count() public int Count()
@ -972,7 +983,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
if (expiredscopes.Count > 0) if (expiredscopes.Count > 0)
{ {
foreach (UUID sid in expiredscopes) foreach (UUID sid in expiredscopes)
{
InfobyScope[sid] = null;
InfobyScope.Remove(sid); InfobyScope.Remove(sid);
}
} }
} }
finally { Monitor.Exit(syncRoot); } finally { Monitor.Exit(syncRoot); }

View File

@ -79,12 +79,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
private List<string> m_warnings = new List<string>(); private List<string> m_warnings = new List<string>();
// private object m_syncy = new object();
// private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
// private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
// private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
private static UInt64 scriptCompileCounter = 0; // And a counter private static UInt64 scriptCompileCounter = 0; // And a counter
public IScriptEngine m_scriptEngine; public IScriptEngine m_scriptEngine;
@ -251,23 +245,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
} }
} }
////private ICodeCompiler icc = codeProvider.CreateCompiler();
//public string CompileFromFile(string LSOFileName)
//{
// switch (Path.GetExtension(LSOFileName).ToLower())
// {
// case ".txt":
// case ".lsl":
// Common.ScriptEngineBase.Shared.SendToDebug("Source code is LSL, converting to CS");
// return CompileFromLSLText(File.ReadAllText(LSOFileName));
// case ".cs":
// Common.ScriptEngineBase.Shared.SendToDebug("Source code is CS");
// return CompileFromCSText(File.ReadAllText(LSOFileName));
// default:
// throw new Exception("Unknown script type.");
// }
//}
public string GetCompilerOutput(string assetID) public string GetCompilerOutput(string assetID)
{ {
return Path.Combine(ScriptEnginesPath, Path.Combine( return Path.Combine(ScriptEnginesPath, Path.Combine(
@ -578,8 +555,6 @@ namespace SecondLife
switch (lang) switch (lang)
{ {
case enumCompileType.vb: case enumCompileType.vb:
// results = VBcodeProvider.CompileAssemblyFromSource(
// parameters, Script);
provider = CodeDomProvider.CreateProvider("VisualBasic"); provider = CodeDomProvider.CreateProvider("VisualBasic");
break; break;
case enumCompileType.cs: case enumCompileType.cs:
@ -594,56 +569,36 @@ namespace SecondLife
if(provider == null) if(provider == null)
throw new Exception("Compiler failed to load "); throw new Exception("Compiler failed to load ");
bool complete = false;
bool retried = false;
bool complete = false; do
bool retried = false; {
results = provider.CompileAssemblyFromSource(
do parameters, Script);
// Deal with an occasional segv in the compiler.
// Rarely, if ever, occurs twice in succession.
// Line # == 0 and no file name are indications that
// this is a native stack trace rather than a normal
// error log.
if (results.Errors.Count > 0)
{
if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) &&
results.Errors[0].Line == 0)
{ {
// lock (CScodeProvider) // System.Console.WriteLine("retrying failed compilation");
// { retried = true;
// results = CScodeProvider.CompileAssemblyFromSource( }
// parameters, Script); else
// } {
complete = true;
results = provider.CompileAssemblyFromSource( }
parameters, Script); }
// Deal with an occasional segv in the compiler. else
// Rarely, if ever, occurs twice in succession. {
// Line # == 0 and no file name are indications that complete = true;
// this is a native stack trace rather than a normal }
// error log. } while (!complete);
if (results.Errors.Count > 0)
{
if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) &&
results.Errors[0].Line == 0)
{
// System.Console.WriteLine("retrying failed compilation");
retried = true;
}
else
{
complete = true;
}
}
else
{
complete = true;
}
} while (!complete);
// break;
// default:
// throw new Exception("Compiler is not able to recongnize " +
// "language type \"" + lang.ToString() + "\"");
// }
// foreach (Type type in results.CompiledAssembly.GetTypes())
// {
// foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static))
// {
// m_log.DebugFormat("[COMPILER]: {0}.{1}", type.FullName, method.Name);
// }
// }
// //
// WARNINGS AND ERRORS // WARNINGS AND ERRORS

View File

@ -2149,10 +2149,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
string fn = Path.GetFileName(assemName); string fn = Path.GetFileName(assemName);
string assem = String.Empty; string assem = String.Empty;
string assemNameText = assemName + ".text";
if (File.Exists(assemName + ".text")) if (File.Exists(assemNameText))
{ {
FileInfo tfi = new FileInfo(assemName + ".text"); FileInfo tfi = new FileInfo(assemNameText);
if (tfi != null) if (tfi != null)
{ {
@ -2160,7 +2161,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
try try
{ {
using (FileStream tfs = File.Open(assemName + ".text", using (FileStream tfs = File.Open(assemNameText,
FileMode.Open, FileAccess.Read)) FileMode.Open, FileAccess.Read))
{ {
tfs.Read(tdata, 0, tdata.Length); tfs.Read(tdata, 0, tdata.Length);