mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 04:05:42 +08:00
Merge branch 'master' into httptests
This commit is contained in:
@@ -646,7 +646,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
if (m_LogLevel >= 2)
|
||||
m_log.Debug("[FLOTSAM ASSET CACHE]: Clearing caches.");
|
||||
|
||||
if (m_FileCacheEnabled)
|
||||
if (m_FileCacheEnabled && Directory.Exists(m_CacheDirectory))
|
||||
{
|
||||
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
|
||||
{
|
||||
@@ -681,10 +681,10 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
// before cleaning up expired files we must scan the objects in the scene to make sure that we retain
|
||||
// such local assets if they have not been recently accessed.
|
||||
TouchAllSceneAssets(false);
|
||||
|
||||
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
|
||||
if(Directory.Exists(m_CacheDirectory))
|
||||
{
|
||||
CleanExpiredFiles(dir, purgeLine);
|
||||
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
|
||||
CleanExpiredFiles(dir, purgeLine);
|
||||
}
|
||||
|
||||
lock(timerLock)
|
||||
@@ -706,6 +706,9 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
{
|
||||
try
|
||||
{
|
||||
if(!Directory.Exists(dir))
|
||||
return;
|
||||
|
||||
foreach (string file in Directory.GetFiles(dir))
|
||||
{
|
||||
if (File.GetLastAccessTime(file) < purgeLine)
|
||||
@@ -869,6 +872,9 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
/// <returns></returns>
|
||||
private int GetFileCacheCount(string dir)
|
||||
{
|
||||
if(!Directory.Exists(dir))
|
||||
return 0;
|
||||
|
||||
int count = Directory.GetFiles(dir).Length;
|
||||
|
||||
foreach (string subdir in Directory.GetDirectories(dir))
|
||||
@@ -987,6 +993,9 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
/// </summary>
|
||||
private void ClearFileCache()
|
||||
{
|
||||
if(!Directory.Exists(m_CacheDirectory))
|
||||
return;
|
||||
|
||||
foreach (string dir in Directory.GetDirectories(m_CacheDirectory))
|
||||
{
|
||||
try
|
||||
|
||||
@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||
public void Process()
|
||||
{
|
||||
_finished = false;
|
||||
httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false);
|
||||
httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -385,7 +385,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
storage[handle] = region;
|
||||
byname[region.RegionName] = handle;
|
||||
byuuid[region.RegionID] = handle;
|
||||
|
||||
}
|
||||
|
||||
public void Remove(GridRegion region)
|
||||
@@ -400,7 +399,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
ulong handle = region.RegionHandle & HANDLEMASK;
|
||||
if(storage != null)
|
||||
storage.Remove(handle);
|
||||
{
|
||||
if(storage.ContainsKey(handle))
|
||||
{
|
||||
storage[handle] = null;
|
||||
storage.Remove(handle);
|
||||
}
|
||||
}
|
||||
removeFromInner(region);
|
||||
if(expires != null)
|
||||
{
|
||||
@@ -424,6 +429,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
if(byuuid != null)
|
||||
byuuid.Remove(r.RegionID);
|
||||
removeFromInner(r);
|
||||
storage[handle] = null;
|
||||
}
|
||||
storage.Remove(handle);
|
||||
}
|
||||
@@ -581,27 +587,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
{
|
||||
if(expires == null || expires.Count == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
int expiresCount = expires.Count;
|
||||
List<ulong> toexpire = new List<ulong>();
|
||||
|
||||
foreach(KeyValuePair<ulong, DateTime> kvp in expires)
|
||||
{
|
||||
if(kvp.Value < now)
|
||||
toexpire.Add(kvp.Key);
|
||||
}
|
||||
|
||||
if(toexpire.Count == 0)
|
||||
return expires.Count;
|
||||
int toexpireCount = toexpire.Count;
|
||||
if(toexpireCount == 0)
|
||||
return expiresCount;
|
||||
|
||||
if(toexpire.Count == expires.Count)
|
||||
if(toexpireCount == expiresCount)
|
||||
{
|
||||
Clear();
|
||||
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))
|
||||
{
|
||||
GridRegion r = storage[h];
|
||||
@@ -610,14 +621,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
if(byuuid != null)
|
||||
byuuid.Remove(r.RegionID);
|
||||
removeFromInner(r);
|
||||
|
||||
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)
|
||||
expiresCount = expires.Count;
|
||||
if(expiresCount == 0)
|
||||
{
|
||||
byname = null;
|
||||
byuuid = null;
|
||||
@@ -626,7 +645,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
return 0;
|
||||
}
|
||||
|
||||
return expires.Count;
|
||||
return expiresCount;
|
||||
}
|
||||
|
||||
public int Count()
|
||||
@@ -693,7 +712,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
public class RegionsExpiringCache
|
||||
{
|
||||
const double CACHE_PURGE_HZ = 60; // seconds
|
||||
const double CACHE_PURGE_TIME = 60000; // milliseconds
|
||||
const int MAX_LOCK_WAIT = 10000; // milliseconds
|
||||
|
||||
/// <summary>For thread safety</summary>
|
||||
@@ -702,7 +721,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
object isPurging = new object();
|
||||
|
||||
Dictionary<UUID, RegionInfoForScope> InfobyScope = new Dictionary<UUID, RegionInfoForScope>();
|
||||
private System.Timers.Timer timer = new System.Timers.Timer(TimeSpan.FromSeconds(CACHE_PURGE_HZ).TotalMilliseconds);
|
||||
private System.Timers.Timer timer = new System.Timers.Timer(CACHE_PURGE_TIME);
|
||||
|
||||
public RegionsExpiringCache()
|
||||
{
|
||||
@@ -965,7 +984,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
if (expiredscopes.Count > 0)
|
||||
{
|
||||
foreach (UUID sid in expiredscopes)
|
||||
{
|
||||
InfobyScope[sid] = null;
|
||||
InfobyScope.Remove(sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally { Monitor.Exit(syncRoot); }
|
||||
|
||||
@@ -716,12 +716,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Watchdog.UpdateThread();
|
||||
|
||||
av = null;
|
||||
st = null;
|
||||
|
||||
st = requests.Dequeue(4900); // timeout to make watchdog happy
|
||||
st = requests.Dequeue(4500);
|
||||
Watchdog.UpdateThread();
|
||||
|
||||
if (st == null || st.agentID == UUID.Zero)
|
||||
continue;
|
||||
@@ -1152,10 +1151,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||
{
|
||||
while(!m_mapBlockRequestEvent.WaitOne(4900))
|
||||
{
|
||||
Watchdog.UpdateThread();
|
||||
if(m_scene == null)
|
||||
return;
|
||||
}
|
||||
|
||||
Watchdog.UpdateThread();
|
||||
lock (m_mapBlockRequestEvent)
|
||||
{
|
||||
int total = 0;
|
||||
|
||||
Reference in New Issue
Block a user