aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs17
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs52
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs8
4 files changed, 55 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 610e279..e5ac17d 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -646,7 +646,7 @@ namespace OpenSim.Region.CoreModules.Asset
646 if (m_LogLevel >= 2) 646 if (m_LogLevel >= 2)
647 m_log.Debug("[FLOTSAM ASSET CACHE]: Clearing caches."); 647 m_log.Debug("[FLOTSAM ASSET CACHE]: Clearing caches.");
648 648
649 if (m_FileCacheEnabled) 649 if (m_FileCacheEnabled && Directory.Exists(m_CacheDirectory))
650 { 650 {
651 foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) 651 foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
652 { 652 {
@@ -681,10 +681,10 @@ namespace OpenSim.Region.CoreModules.Asset
681 // before cleaning up expired files we must scan the objects in the scene to make sure that we retain 681 // before cleaning up expired files we must scan the objects in the scene to make sure that we retain
682 // such local assets if they have not been recently accessed. 682 // such local assets if they have not been recently accessed.
683 TouchAllSceneAssets(false); 683 TouchAllSceneAssets(false);
684 684 if(Directory.Exists(m_CacheDirectory))
685 foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
686 { 685 {
687 CleanExpiredFiles(dir, purgeLine); 686 foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
687 CleanExpiredFiles(dir, purgeLine);
688 } 688 }
689 689
690 lock(timerLock) 690 lock(timerLock)
@@ -706,6 +706,9 @@ namespace OpenSim.Region.CoreModules.Asset
706 { 706 {
707 try 707 try
708 { 708 {
709 if(!Directory.Exists(dir))
710 return;
711
709 foreach (string file in Directory.GetFiles(dir)) 712 foreach (string file in Directory.GetFiles(dir))
710 { 713 {
711 if (File.GetLastAccessTime(file) < purgeLine) 714 if (File.GetLastAccessTime(file) < purgeLine)
@@ -869,6 +872,9 @@ namespace OpenSim.Region.CoreModules.Asset
869 /// <returns></returns> 872 /// <returns></returns>
870 private int GetFileCacheCount(string dir) 873 private int GetFileCacheCount(string dir)
871 { 874 {
875 if(!Directory.Exists(dir))
876 return 0;
877
872 int count = Directory.GetFiles(dir).Length; 878 int count = Directory.GetFiles(dir).Length;
873 879
874 foreach (string subdir in Directory.GetDirectories(dir)) 880 foreach (string subdir in Directory.GetDirectories(dir))
@@ -987,6 +993,9 @@ namespace OpenSim.Region.CoreModules.Asset
987 /// </summary> 993 /// </summary>
988 private void ClearFileCache() 994 private void ClearFileCache()
989 { 995 {
996 if(!Directory.Exists(m_CacheDirectory))
997 return;
998
990 foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) 999 foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
991 { 1000 {
992 try 1001 try
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index aed1372..f68c5f8 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
658 public void Process() 658 public void Process()
659 { 659 {
660 _finished = false; 660 _finished = false;
661 httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false); 661 httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue);
662 } 662 }
663 663
664 /* 664 /*
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
index 84e52f7..f6fff58 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs
@@ -385,7 +385,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
385 storage[handle] = region; 385 storage[handle] = region;
386 byname[region.RegionName] = handle; 386 byname[region.RegionName] = handle;
387 byuuid[region.RegionID] = handle; 387 byuuid[region.RegionID] = handle;
388
389 } 388 }
390 389
391 public void Remove(GridRegion region) 390 public void Remove(GridRegion region)
@@ -400,7 +399,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
400 399
401 ulong handle = region.RegionHandle & HANDLEMASK; 400 ulong handle = region.RegionHandle & HANDLEMASK;
402 if(storage != null) 401 if(storage != null)
403 storage.Remove(handle); 402 {
403 if(storage.ContainsKey(handle))
404 {
405 storage[handle] = null;
406 storage.Remove(handle);
407 }
408 }
404 removeFromInner(region); 409 removeFromInner(region);
405 if(expires != null) 410 if(expires != null)
406 { 411 {
@@ -424,6 +429,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
424 if(byuuid != null) 429 if(byuuid != null)
425 byuuid.Remove(r.RegionID); 430 byuuid.Remove(r.RegionID);
426 removeFromInner(r); 431 removeFromInner(r);
432 storage[handle] = null;
427 } 433 }
428 storage.Remove(handle); 434 storage.Remove(handle);
429 } 435 }
@@ -581,27 +587,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
581 { 587 {
582 if(expires == null || expires.Count == 0) 588 if(expires == null || expires.Count == 0)
583 return 0; 589 return 0;
584 590
591 int expiresCount = expires.Count;
585 List<ulong> toexpire = new List<ulong>(); 592 List<ulong> toexpire = new List<ulong>();
593
586 foreach(KeyValuePair<ulong, DateTime> kvp in expires) 594 foreach(KeyValuePair<ulong, DateTime> kvp in expires)
587 { 595 {
588 if(kvp.Value < now) 596 if(kvp.Value < now)
589 toexpire.Add(kvp.Key); 597 toexpire.Add(kvp.Key);
590 } 598 }
591 599
592 if(toexpire.Count == 0) 600 int toexpireCount = toexpire.Count;
593 return expires.Count; 601 if(toexpireCount == 0)
602 return expiresCount;
594 603
595 if(toexpire.Count == expires.Count) 604 if(toexpireCount == expiresCount)
596 { 605 {
597 Clear(); 606 Clear();
598 return 0; 607 return 0;
599 } 608 }
600 609
601 foreach(ulong h in toexpire) 610 if(storage != null)
602 { 611 {
603 if(storage != null) 612 ulong h;
613 for(int i = 0; i < toexpireCount; i++)
604 { 614 {
615 h = toexpire[i];
605 if(storage.ContainsKey(h)) 616 if(storage.ContainsKey(h))
606 { 617 {
607 GridRegion r = storage[h]; 618 GridRegion r = storage[h];
@@ -610,14 +621,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
610 if(byuuid != null) 621 if(byuuid != null)
611 byuuid.Remove(r.RegionID); 622 byuuid.Remove(r.RegionID);
612 removeFromInner(r); 623 removeFromInner(r);
624
625 storage[h] = null;
626 storage.Remove(h);
613 } 627 }
614 storage.Remove(h); 628 if(expires != null)
629 expires.Remove(h);
615 } 630 }
616 if(expires != null) 631 }
617 expires.Remove(h); 632 else
633 {
634 Clear();
635 return 0;
618 } 636 }
619 637
620 if(expires.Count == 0) 638 expiresCount = expires.Count;
639 if(expiresCount == 0)
621 { 640 {
622 byname = null; 641 byname = null;
623 byuuid = null; 642 byuuid = null;
@@ -626,7 +645,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
626 return 0; 645 return 0;
627 } 646 }
628 647
629 return expires.Count; 648 return expiresCount;
630 } 649 }
631 650
632 public int Count() 651 public int Count()
@@ -693,7 +712,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
693 712
694 public class RegionsExpiringCache 713 public class RegionsExpiringCache
695 { 714 {
696 const double CACHE_PURGE_HZ = 60; // seconds 715 const double CACHE_PURGE_TIME = 60000; // milliseconds
697 const int MAX_LOCK_WAIT = 10000; // milliseconds 716 const int MAX_LOCK_WAIT = 10000; // milliseconds
698 717
699 /// <summary>For thread safety</summary> 718 /// <summary>For thread safety</summary>
@@ -702,7 +721,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
702 object isPurging = new object(); 721 object isPurging = new object();
703 722
704 Dictionary<UUID, RegionInfoForScope> InfobyScope = new Dictionary<UUID, RegionInfoForScope>(); 723 Dictionary<UUID, RegionInfoForScope> InfobyScope = new Dictionary<UUID, RegionInfoForScope>();
705 private System.Timers.Timer timer = new System.Timers.Timer(TimeSpan.FromSeconds(CACHE_PURGE_HZ).TotalMilliseconds); 724 private System.Timers.Timer timer = new System.Timers.Timer(CACHE_PURGE_TIME);
706 725
707 public RegionsExpiringCache() 726 public RegionsExpiringCache()
708 { 727 {
@@ -965,7 +984,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
965 if (expiredscopes.Count > 0) 984 if (expiredscopes.Count > 0)
966 { 985 {
967 foreach (UUID sid in expiredscopes) 986 foreach (UUID sid in expiredscopes)
987 {
988 InfobyScope[sid] = null;
968 InfobyScope.Remove(sid); 989 InfobyScope.Remove(sid);
990 }
969 } 991 }
970 } 992 }
971 finally { Monitor.Exit(syncRoot); } 993 finally { Monitor.Exit(syncRoot); }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 00c8279..03a4d34 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -716,12 +716,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
716 { 716 {
717 while (true) 717 while (true)
718 { 718 {
719 Watchdog.UpdateThread();
720
721 av = null; 719 av = null;
722 st = null; 720 st = null;
723 721
724 st = requests.Dequeue(4900); // timeout to make watchdog happy 722 st = requests.Dequeue(4500);
723 Watchdog.UpdateThread();
725 724
726 if (st == null || st.agentID == UUID.Zero) 725 if (st == null || st.agentID == UUID.Zero)
727 continue; 726 continue;
@@ -1152,10 +1151,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1152 { 1151 {
1153 while(!m_mapBlockRequestEvent.WaitOne(4900)) 1152 while(!m_mapBlockRequestEvent.WaitOne(4900))
1154 { 1153 {
1154 Watchdog.UpdateThread();
1155 if(m_scene == null) 1155 if(m_scene == null)
1156 return; 1156 return;
1157 } 1157 }
1158 1158 Watchdog.UpdateThread();
1159 lock (m_mapBlockRequestEvent) 1159 lock (m_mapBlockRequestEvent)
1160 { 1160 {
1161 int total = 0; 1161 int total = 0;