aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-02-12 21:32:03 +0000
committerJustin Clark-Casey (justincc)2010-02-12 21:32:03 +0000
commit802a969267da9ed2780ea66c736c3d531e336dfa (patch)
tree85b088d4e9b4cf3dbb800845a27cf8f42e6e4094 /OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
parentAdd missing refernce to prebuild (backport from presence-refactor) (diff)
downloadopensim-SC_OLD-802a969267da9ed2780ea66c736c3d531e336dfa.zip
opensim-SC_OLD-802a969267da9ed2780ea66c736c3d531e336dfa.tar.gz
opensim-SC_OLD-802a969267da9ed2780ea66c736c3d531e336dfa.tar.bz2
opensim-SC_OLD-802a969267da9ed2780ea66c736c3d531e336dfa.tar.xz
Fix http://opensimulator.org/mantis/view.php?id=4224
This resolves the problem where eyes and hair would turn white on standalone configurations When a client receives body part information, for some insane reason or other it always ends up uploading this back to the server and then immediately re-requesting it. This should have been okay since we stored that asset in cache. However, the standalone asset service connector was not checking this cache properly, so every time the client made the request for the asset it has just loaded it would get a big fat null back in the face, causing it to make clothes and hair white. This bug did not affect grids since they use a different service connector.
Diffstat (limited to 'OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs')
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs27
1 files changed, 14 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 1add0ab..1903eb9 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.Asset
91 /// </example> 91 /// </example>
92 public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule 92 public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule
93 { 93 {
94 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
95
94 /// <summary> 96 /// <summary>
95 /// Cache's default maximal asset count. 97 /// Cache's default maximal asset count.
96 /// </summary> 98 /// </summary>
@@ -115,12 +117,7 @@ namespace OpenSim.Region.CoreModules.Asset
115 /// Asset's default expiration time in the cache. 117 /// Asset's default expiration time in the cache.
116 /// </summary> 118 /// </summary>
117 public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0); 119 public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0);
118 120
119 /// <summary>
120 /// Log manager instance.
121 /// </summary>
122 private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
123
124 /// <summary> 121 /// <summary>
125 /// Cache object. 122 /// Cache object.
126 /// </summary> 123 /// </summary>
@@ -170,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Asset
170 { 167 {
171 if (maximalSize <= 0 || maximalCount <= 0) 168 if (maximalSize <= 0 || maximalCount <= 0)
172 { 169 {
173 //Log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled."); 170 //m_log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled.");
174 m_enabled = false; 171 m_enabled = false;
175 return; 172 return;
176 } 173 }
@@ -186,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Asset
186 CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>( 183 CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>(
187 maximalSize, maximalCount, expirationTime)); 184 maximalSize, maximalCount, expirationTime));
188 m_enabled = true; 185 m_enabled = true;
189 Log.DebugFormat( 186 m_log.DebugFormat(
190 "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", 187 "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})",
191 maximalSize, 188 maximalSize,
192 maximalCount, 189 maximalCount,
@@ -205,6 +202,8 @@ namespace OpenSim.Region.CoreModules.Asset
205 { 202 {
206 if (asset != null) 203 if (asset != null)
207 { 204 {
205// m_log.DebugFormat("[CENOME ASSET CACHE]: Caching asset {0}", asset.ID);
206
208 long size = asset.Data != null ? asset.Data.Length : 1; 207 long size = asset.Data != null ? asset.Data.Length : 1;
209 m_cache.Set(asset.ID, asset, size); 208 m_cache.Set(asset.ID, asset, size);
210 m_cachedCount++; 209 m_cachedCount++;
@@ -255,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Asset
255 254
256 if (m_getCount == m_debugEpoch) 255 if (m_getCount == m_debugEpoch)
257 { 256 {
258 Log.DebugFormat( 257 m_log.DebugFormat(
259 "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", 258 "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes",
260 m_cachedCount, 259 m_cachedCount,
261 m_getCount, 260 m_getCount,
@@ -267,6 +266,9 @@ namespace OpenSim.Region.CoreModules.Asset
267 m_cachedCount = 0; 266 m_cachedCount = 0;
268 } 267 }
269 268
269// if (null == assetBase)
270// m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id);
271
270 return assetBase; 272 return assetBase;
271 } 273 }
272 274
@@ -325,12 +327,11 @@ namespace OpenSim.Region.CoreModules.Asset
325 return; 327 return;
326 328
327 string name = moduleConfig.GetString("AssetCaching"); 329 string name = moduleConfig.GetString("AssetCaching");
328 //Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); 330 //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
329 331
330 if (name != Name) 332 if (name != Name)
331 return; 333 return;
332 334
333 // This module is used
334 long maxSize = DefaultMaxSize; 335 long maxSize = DefaultMaxSize;
335 int maxCount = DefaultMaxCount; 336 int maxCount = DefaultMaxCount;
336 TimeSpan expirationTime = DefaultExpirationTime; 337 TimeSpan expirationTime = DefaultExpirationTime;