aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2017-05-27 05:41:40 +0100
committerUbitUmarov2017-05-27 05:41:40 +0100
commit289d4ca128d278aed49044b92411234d5f57b781 (patch)
treeb9a10c96569d51102218e041fc3a018643fd230f /OpenSim
parentlose a ref (diff)
downloadopensim-SC_OLD-289d4ca128d278aed49044b92411234d5f57b781.zip
opensim-SC_OLD-289d4ca128d278aed49044b92411234d5f57b781.tar.gz
opensim-SC_OLD-289d4ca128d278aed49044b92411234d5f57b781.tar.bz2
opensim-SC_OLD-289d4ca128d278aed49044b92411234d5f57b781.tar.xz
minor cleanup
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs34
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs101
-rwxr-xr-xOpenSim/Region/ScriptEngine/XEngine/XEngine.cs7
3 files changed, 56 insertions, 86 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
index 5d90b97..f3c2900 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
@@ -429,6 +429,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
429 if(byuuid != null) 429 if(byuuid != null)
430 byuuid.Remove(r.RegionID); 430 byuuid.Remove(r.RegionID);
431 removeFromInner(r); 431 removeFromInner(r);
432 storage[handle] = null;
432 } 433 }
433 storage.Remove(handle); 434 storage.Remove(handle);
434 } 435 }
@@ -586,27 +587,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
586 { 587 {
587 if(expires == null || expires.Count == 0) 588 if(expires == null || expires.Count == 0)
588 return 0; 589 return 0;
589 590
591 int expiresCount = expires.Count;
590 List<ulong> toexpire = new List<ulong>(); 592 List<ulong> toexpire = new List<ulong>();
593
591 foreach(KeyValuePair<ulong, DateTime> kvp in expires) 594 foreach(KeyValuePair<ulong, DateTime> kvp in expires)
592 { 595 {
593 if(kvp.Value < now) 596 if(kvp.Value < now)
594 toexpire.Add(kvp.Key); 597 toexpire.Add(kvp.Key);
595 } 598 }
596 599
597 if(toexpire.Count == 0) 600 int toexpireCount = toexpire.Count;
598 return expires.Count; 601 if(toexpireCount == 0)
602 return expiresCount;
599 603
600 if(toexpire.Count == expires.Count) 604 if(toexpireCount == expiresCount)
601 { 605 {
602 Clear(); 606 Clear();
603 return 0; 607 return 0;
604 } 608 }
605 609
606 foreach(ulong h in toexpire) 610 if(storage != null)
607 { 611 {
608 if(storage != null) 612 ulong h;
613 for(int i = 0; i < toexpireCount; i++)
609 { 614 {
615 h = toexpire[i];
610 if(storage.ContainsKey(h)) 616 if(storage.ContainsKey(h))
611 { 617 {
612 GridRegion r = storage[h]; 618 GridRegion r = storage[h];
@@ -619,12 +625,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
619 storage[h] = null; 625 storage[h] = null;
620 storage.Remove(h); 626 storage.Remove(h);
621 } 627 }
628 if(expires != null)
629 expires.Remove(h);
622 } 630 }
623 if(expires != null) 631 }
624 expires.Remove(h); 632 else
633 {
634 Clear();
635 return 0;
625 } 636 }
626 637
627 if(expires.Count == 0) 638 if(expiresCount == 0)
628 { 639 {
629 byname = null; 640 byname = null;
630 byuuid = null; 641 byuuid = null;
@@ -633,7 +644,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
633 return 0; 644 return 0;
634 } 645 }
635 646
636 return expires.Count; 647 return expiresCount;
637 } 648 }
638 649
639 public int Count() 650 public int Count()
@@ -972,7 +983,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
972 if (expiredscopes.Count > 0) 983 if (expiredscopes.Count > 0)
973 { 984 {
974 foreach (UUID sid in expiredscopes) 985 foreach (UUID sid in expiredscopes)
986 {
987 InfobyScope[sid] = null;
975 InfobyScope.Remove(sid); 988 InfobyScope.Remove(sid);
989 }
976 } 990 }
977 } 991 }
978 finally { Monitor.Exit(syncRoot); } 992 finally { Monitor.Exit(syncRoot); }
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index f3b8e1d..20f9770 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -79,12 +79,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
79 79
80 private List<string> m_warnings = new List<string>(); 80 private List<string> m_warnings = new List<string>();
81 81
82 // private object m_syncy = new object();
83
84// private static CSharpCodeProvider CScodeProvider = new CSharpCodeProvider();
85// private static VBCodeProvider VBcodeProvider = new VBCodeProvider();
86
87 // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files
88 private static UInt64 scriptCompileCounter = 0; // And a counter 82 private static UInt64 scriptCompileCounter = 0; // And a counter
89 83
90 public IScriptEngine m_scriptEngine; 84 public IScriptEngine m_scriptEngine;
@@ -251,23 +245,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
251 } 245 }
252 } 246 }
253 247
254 ////private ICodeCompiler icc = codeProvider.CreateCompiler();
255 //public string CompileFromFile(string LSOFileName)
256 //{
257 // switch (Path.GetExtension(LSOFileName).ToLower())
258 // {
259 // case ".txt":
260 // case ".lsl":
261 // Common.ScriptEngineBase.Shared.SendToDebug("Source code is LSL, converting to CS");
262 // return CompileFromLSLText(File.ReadAllText(LSOFileName));
263 // case ".cs":
264 // Common.ScriptEngineBase.Shared.SendToDebug("Source code is CS");
265 // return CompileFromCSText(File.ReadAllText(LSOFileName));
266 // default:
267 // throw new Exception("Unknown script type.");
268 // }
269 //}
270
271 public string GetCompilerOutput(string assetID) 248 public string GetCompilerOutput(string assetID)
272 { 249 {
273 return Path.Combine(ScriptEnginesPath, Path.Combine( 250 return Path.Combine(ScriptEnginesPath, Path.Combine(
@@ -578,8 +555,6 @@ namespace SecondLife
578 switch (lang) 555 switch (lang)
579 { 556 {
580 case enumCompileType.vb: 557 case enumCompileType.vb:
581// results = VBcodeProvider.CompileAssemblyFromSource(
582// parameters, Script);
583 provider = CodeDomProvider.CreateProvider("VisualBasic"); 558 provider = CodeDomProvider.CreateProvider("VisualBasic");
584 break; 559 break;
585 case enumCompileType.cs: 560 case enumCompileType.cs:
@@ -594,56 +569,36 @@ namespace SecondLife
594 if(provider == null) 569 if(provider == null)
595 throw new Exception("Compiler failed to load "); 570 throw new Exception("Compiler failed to load ");
596 571
572 bool complete = false;
573 bool retried = false;
597 574
598 bool complete = false; 575 do
599 bool retried = false; 576 {
600 577 results = provider.CompileAssemblyFromSource(
601 do 578 parameters, Script);
579 // Deal with an occasional segv in the compiler.
580 // Rarely, if ever, occurs twice in succession.
581 // Line # == 0 and no file name are indications that
582 // this is a native stack trace rather than a normal
583 // error log.
584 if (results.Errors.Count > 0)
585 {
586 if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) &&
587 results.Errors[0].Line == 0)
602 { 588 {
603// lock (CScodeProvider) 589 // System.Console.WriteLine("retrying failed compilation");
604// { 590 retried = true;
605// results = CScodeProvider.CompileAssemblyFromSource( 591 }
606// parameters, Script); 592 else
607// } 593 {
608 594 complete = true;
609 results = provider.CompileAssemblyFromSource( 595 }
610 parameters, Script); 596 }
611 // Deal with an occasional segv in the compiler. 597 else
612 // Rarely, if ever, occurs twice in succession. 598 {
613 // Line # == 0 and no file name are indications that 599 complete = true;
614 // this is a native stack trace rather than a normal 600 }
615 // error log. 601 } while (!complete);
616 if (results.Errors.Count > 0)
617 {
618 if (!retried && string.IsNullOrEmpty(results.Errors[0].FileName) &&
619 results.Errors[0].Line == 0)
620 {
621 // System.Console.WriteLine("retrying failed compilation");
622 retried = true;
623 }
624 else
625 {
626 complete = true;
627 }
628 }
629 else
630 {
631 complete = true;
632 }
633 } while (!complete);
634// break;
635// default:
636// throw new Exception("Compiler is not able to recongnize " +
637// "language type \"" + lang.ToString() + "\"");
638// }
639
640// foreach (Type type in results.CompiledAssembly.GetTypes())
641// {
642// foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static))
643// {
644// m_log.DebugFormat("[COMPILER]: {0}.{1}", type.FullName, method.Name);
645// }
646// }
647 602
648 // 603 //
649 // WARNINGS AND ERRORS 604 // WARNINGS AND ERRORS
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index c1abba2..870957b 100755
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -2149,10 +2149,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2149 string fn = Path.GetFileName(assemName); 2149 string fn = Path.GetFileName(assemName);
2150 2150
2151 string assem = String.Empty; 2151 string assem = String.Empty;
2152 string assemNameText = assemName + ".text";
2152 2153
2153 if (File.Exists(assemName + ".text")) 2154 if (File.Exists(assemNameText))
2154 { 2155 {
2155 FileInfo tfi = new FileInfo(assemName + ".text"); 2156 FileInfo tfi = new FileInfo(assemNameText);
2156 2157
2157 if (tfi != null) 2158 if (tfi != null)
2158 { 2159 {
@@ -2160,7 +2161,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
2160 2161
2161 try 2162 try
2162 { 2163 {
2163 using (FileStream tfs = File.Open(assemName + ".text", 2164 using (FileStream tfs = File.Open(assemNameText,
2164 FileMode.Open, FileAccess.Read)) 2165 FileMode.Open, FileAccess.Read))
2165 { 2166 {
2166 tfs.Read(tdata, 0, tdata.Length); 2167 tfs.Read(tdata, 0, tdata.Length);