aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/IImprovedAssetCache.cs1
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs29
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs6
-rw-r--r--OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs75
-rw-r--r--OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs5
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs51
7 files changed, 151 insertions, 20 deletions
diff --git a/OpenSim/Framework/IImprovedAssetCache.cs b/OpenSim/Framework/IImprovedAssetCache.cs
index 251215a..a0b8b55 100644
--- a/OpenSim/Framework/IImprovedAssetCache.cs
+++ b/OpenSim/Framework/IImprovedAssetCache.cs
@@ -33,6 +33,7 @@ namespace OpenSim.Framework
33 { 33 {
34 void Cache(AssetBase asset); 34 void Cache(AssetBase asset);
35 AssetBase Get(string id); 35 AssetBase Get(string id);
36 bool Check(string id);
36 void Expire(string id); 37 void Expire(string id);
37 void Clear(); 38 void Clear();
38 } 39 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index ea3c6a4..edb1a9d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -3992,7 +3992,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3992 3992
3993 const float TIME_DILATION = 1.0f; 3993 const float TIME_DILATION = 1.0f;
3994 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); 3994 ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
3995
3996 3995
3997 if (terseAgentUpdateBlocks.IsValueCreated) 3996 if (terseAgentUpdateBlocks.IsValueCreated)
3998 { 3997 {
@@ -11695,14 +11694,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11695 cachedresp.WearableData = 11694 cachedresp.WearableData =
11696 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; 11695 new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length];
11697 11696
11698 for (int i = 0; i < cachedtex.WearableData.Length; i++) 11697 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
11698 if (cache == null)
11699 { 11699 {
11700 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); 11700 for (int i = 0; i < cachedtex.WearableData.Length; i++)
11701 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; 11701 {
11702 cachedresp.WearableData[i].TextureID = UUID.Zero; 11702 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11703 cachedresp.WearableData[i].HostName = new byte[0]; 11703 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11704 cachedresp.WearableData[i].TextureID = UUID.Zero;
11705 cachedresp.WearableData[i].HostName = new byte[0];
11706 }
11707 }
11708 else
11709 {
11710 for (int i = 0; i < cachedtex.WearableData.Length; i++)
11711 {
11712 cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
11713 cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
11714 if(cache.Check(cachedtex.WearableData[i].ID.ToString()))
11715 cachedresp.WearableData[i].TextureID = UUID.Zero;
11716 else
11717 cachedresp.WearableData[i].TextureID = UUID.Zero;
11718 cachedresp.WearableData[i].HostName = new byte[0];
11719 }
11704 } 11720 }
11705
11706 cachedresp.Header.Zerocoded = true; 11721 cachedresp.Header.Zerocoded = true;
11707 OutPacket(cachedresp, ThrottleOutPacketType.Task); 11722 OutPacket(cachedresp, ThrottleOutPacketType.Task);
11708 11723
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index e40caec..f43305f 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -194,6 +194,12 @@ namespace OpenSim.Region.CoreModules.Asset
194 194
195 #region IImprovedAssetCache Members 195 #region IImprovedAssetCache Members
196 196
197
198 public bool Check(string id)
199 {
200 return false;
201 }
202
197 /// <summary> 203 /// <summary>
198 /// Cache asset. 204 /// Cache asset.
199 /// </summary> 205 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index 9742a5c..58ce61a 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -112,6 +112,10 @@ namespace OpenSim.Region.CoreModules.Asset
112 //////////////////////////////////////////////////////////// 112 ////////////////////////////////////////////////////////////
113 // IImprovedAssetCache 113 // IImprovedAssetCache
114 // 114 //
115 public bool Check(string id)
116 {
117 return false;
118 }
115 119
116 public void Cache(AssetBase asset) 120 public void Cache(AssetBase asset)
117 { 121 {
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index b1bb56b..a0f1e8c 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -348,6 +348,17 @@ namespace OpenSim.Region.CoreModules.Asset
348 return asset; 348 return asset;
349 } 349 }
350 350
351 private bool CheckFromMemoryCache(string id)
352 {
353 AssetBase asset = null;
354
355 if (m_MemoryCache.TryGetValue(id, out asset))
356 return true;
357
358 return false;
359 }
360
361
351 /// <summary> 362 /// <summary>
352 /// Try to get an asset from the file cache. 363 /// Try to get an asset from the file cache.
353 /// </summary> 364 /// </summary>
@@ -420,6 +431,50 @@ namespace OpenSim.Region.CoreModules.Asset
420 return asset; 431 return asset;
421 } 432 }
422 433
434 private bool CheckFromFileCache(string id)
435 {
436 bool found = false;
437
438 string filename = GetFileName(id);
439 if (File.Exists(filename))
440 {
441 // actually check if we can open it, and so update expire
442 FileStream stream = null;
443 try
444 {
445 stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
446 if (stream != null)
447 {
448 found = true;
449 stream.Close();
450 }
451
452 }
453 catch (System.Runtime.Serialization.SerializationException e)
454 {
455 found = false;
456 m_log.ErrorFormat(
457 "[FLOTSAM ASSET CACHE]: Failed to check file {0} for asset {1}. Exception {2} {3}",
458 filename, id, e.Message, e.StackTrace);
459
460 // If there was a problem deserializing the asset, the asset may
461 // either be corrupted OR was serialized under an old format
462 // {different version of AssetBase} -- we should attempt to
463 // delete it and re-cache
464 File.Delete(filename);
465 }
466 catch (Exception e)
467 {
468 found = false;
469 m_log.ErrorFormat(
470 "[FLOTSAM ASSET CACHE]: Failed to check file {0} for asset {1}. Exception {2} {3}",
471 filename, id, e.Message, e.StackTrace);
472 }
473 }
474
475 return found;
476 }
477
423 public AssetBase Get(string id) 478 public AssetBase Get(string id)
424 { 479 {
425 m_Requests++; 480 m_Requests++;
@@ -456,11 +511,26 @@ namespace OpenSim.Region.CoreModules.Asset
456 return asset; 511 return asset;
457 } 512 }
458 513
514 public bool Check(string id)
515 {
516 if (m_MemoryCacheEnabled && CheckFromMemoryCache(id))
517 return true;
518
519 if (m_FileCacheEnabled && CheckFromFileCache(id))
520 return true;
521 return false;
522 }
523
459 public AssetBase GetCached(string id) 524 public AssetBase GetCached(string id)
460 { 525 {
461 return Get(id); 526 return Get(id);
462 } 527 }
463 528
529 public AssetBase CheckCached(string id)
530 {
531 return Get(id);
532 }
533
464 public void Expire(string id) 534 public void Expire(string id)
465 { 535 {
466 if (m_LogLevel >= 2) 536 if (m_LogLevel >= 2)
@@ -941,6 +1011,11 @@ namespace OpenSim.Region.CoreModules.Asset
941 return asset.Data; 1011 return asset.Data;
942 } 1012 }
943 1013
1014 public bool CheckData(string id)
1015 {
1016 return Check(id); ;
1017 }
1018
944 public bool Get(string id, object sender, AssetRetrieved handler) 1019 public bool Get(string id, object sender, AssetRetrieved handler)
945 { 1020 {
946 AssetBase asset = Get(id); 1021 AssetBase asset = Get(id);
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index 9592ca0..ce9b546 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -115,6 +115,11 @@ namespace OpenSim.Region.CoreModules.Asset
115 // IImprovedAssetCache 115 // IImprovedAssetCache
116 // 116 //
117 117
118 public bool Check(string id)
119 {
120 return false;
121 }
122
118 public void Cache(AssetBase asset) 123 public void Cache(AssetBase asset)
119 { 124 {
120 if (asset != null) 125 if (asset != null)
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 4c42397..3532b1d 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -361,6 +361,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
361 public bool ValidateBakedTextureCache(IScenePresence sp) 361 public bool ValidateBakedTextureCache(IScenePresence sp)
362 { 362 {
363 bool defonly = true; // are we only using default textures 363 bool defonly = true; // are we only using default textures
364 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
364 365
365 // Process the texture entry 366 // Process the texture entry
366 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 367 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
@@ -385,8 +386,16 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
385 386
386 defonly = false; // found a non-default texture reference 387 defonly = false; // found a non-default texture reference
387 388
388 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) 389 if (cache != null)
389 return false; 390 {
391 if (!cache.Check(face.TextureID.ToString()))
392 return false;
393 }
394 else
395 {
396 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
397 return false;
398 }
390 } 399 }
391 400
392// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); 401// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
@@ -398,6 +407,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
398 public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) 407 public int RequestRebake(IScenePresence sp, bool missingTexturesOnly)
399 { 408 {
400 int texturesRebaked = 0; 409 int texturesRebaked = 0;
410 IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
401 411
402 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) 412 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
403 { 413 {
@@ -421,21 +431,36 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
421 431
422 if (missingTexturesOnly) 432 if (missingTexturesOnly)
423 { 433 {
424 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) 434 if (cache != null)
425 { 435 {
426 continue; 436 if (cache.Check(face.TextureID.ToString()))
437 continue;
438 else
439 {
440 m_log.DebugFormat(
441 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
442 face.TextureID, idx, sp.Name);
443 }
427 } 444 }
428 else 445 else
429 { 446 {
430 // On inter-simulator teleports, this occurs if baked textures are not being stored by the 447 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
431 // grid asset service (which means that they are not available to the new region and so have 448 {
432 // to be re-requested from the client). 449 continue;
433 // 450 }
434 // The only available core OpenSimulator behaviour right now 451
435 // is not to store these textures, temporarily or otherwise. 452 else
436 m_log.DebugFormat( 453 {
437 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", 454 // On inter-simulator teleports, this occurs if baked textures are not being stored by the
438 face.TextureID, idx, sp.Name); 455 // grid asset service (which means that they are not available to the new region and so have
456 // to be re-requested from the client).
457 //
458 // The only available core OpenSimulator behaviour right now
459 // is not to store these textures, temporarily or otherwise.
460 m_log.DebugFormat(
461 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
462 face.TextureID, idx, sp.Name);
463 }
439 } 464 }
440 } 465 }
441 else 466 else