diff options
author | Justin Clarke Casey | 2008-05-16 17:47:34 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-16 17:47:34 +0000 |
commit | c2581c95779bbf17538e0dedef89ca8b739cef2e (patch) | |
tree | 5460b7f64265534a0578d266fac04377692fff90 | |
parent | * Removing unnecessary LLUUID.Zero check from AssetCache (diff) | |
download | opensim-SC_OLD-c2581c95779bbf17538e0dedef89ca8b739cef2e.zip opensim-SC_OLD-c2581c95779bbf17538e0dedef89ca8b739cef2e.tar.gz opensim-SC_OLD-c2581c95779bbf17538e0dedef89ca8b739cef2e.tar.bz2 opensim-SC_OLD-c2581c95779bbf17538e0dedef89ca8b739cef2e.tar.xz |
* Cache knowledge in the region server that the asset service has reported an asset to be missing
* This prevents repeated requests for the same missing asset to the asset server, hopefully reducing the load a little
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 43 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServerBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/IAssetServer.cs | 3 |
3 files changed, 33 insertions, 15 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index e1d5d32..e6a0852 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
65 | /// </summary> | 65 | /// </summary> |
66 | private Dictionary<LLUUID, TextureImage> Textures; | 66 | private Dictionary<LLUUID, TextureImage> Textures; |
67 | 67 | ||
68 | /// | 68 | /// <summary> |
69 | /// Assets requests which are waiting for asset server data. This includes texture requests | 69 | /// Assets requests which are waiting for asset server data. This includes texture requests |
70 | /// </summary> | 70 | /// </summary> |
71 | private Dictionary<LLUUID, AssetRequest> RequestedAssets; | 71 | private Dictionary<LLUUID, AssetRequest> RequestedAssets; |
@@ -75,7 +75,6 @@ namespace OpenSim.Framework.Communications.Cache | |||
75 | /// </summary> | 75 | /// </summary> |
76 | private List<AssetRequest> AssetRequests; | 76 | private List<AssetRequest> AssetRequests; |
77 | 77 | ||
78 | |||
79 | /// <summary> | 78 | /// <summary> |
80 | /// Until the asset request is fulfilled, each asset request is associated with a list of requesters | 79 | /// Until the asset request is fulfilled, each asset request is associated with a list of requesters |
81 | /// </summary> | 80 | /// </summary> |
@@ -166,11 +165,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
166 | m_assetServer = assetServer; | 165 | m_assetServer = assetServer; |
167 | m_assetServer.SetReceiver(this); | 166 | m_assetServer.SetReceiver(this); |
168 | 167 | ||
169 | m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); | 168 | m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); |
170 | m_assetCacheThread.Name = "AssetCacheThread"; | 169 | m_assetCacheThread.Name = "AssetCacheThread"; |
171 | m_assetCacheThread.IsBackground = true; | 170 | m_assetCacheThread.IsBackground = true; |
172 | m_assetCacheThread.Start(); | 171 | m_assetCacheThread.Start(); |
173 | ThreadTracker.Add(m_assetCacheThread); | 172 | ThreadTracker.Add(m_assetCacheThread); |
174 | } | 173 | } |
175 | 174 | ||
176 | /// <summary> | 175 | /// <summary> |
@@ -452,10 +451,19 @@ namespace OpenSim.Framework.Communications.Cache | |||
452 | } | 451 | } |
453 | 452 | ||
454 | // See IAssetReceiver | 453 | // See IAssetReceiver |
455 | public void AssetNotFound(LLUUID assetID) | 454 | public void AssetNotFound(LLUUID assetID, bool IsTexture) |
456 | { | 455 | { |
457 | // m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); | 456 | m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); |
458 | 457 | ||
458 | if (IsTexture) | ||
459 | { | ||
460 | Textures[assetID] = null; | ||
461 | } | ||
462 | else | ||
463 | { | ||
464 | Assets[assetID] = null; | ||
465 | } | ||
466 | |||
459 | // Notify requesters for this asset | 467 | // Notify requesters for this asset |
460 | AssetRequestsList reqList = null; | 468 | AssetRequestsList reqList = null; |
461 | lock (RequestLists) | 469 | lock (RequestLists) |
@@ -509,7 +517,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
509 | } | 517 | } |
510 | 518 | ||
511 | /// <summary> | 519 | /// <summary> |
512 | /// Make an asset request the result of which will be packeted up and sent directly back to the client. | 520 | /// Handle an asset request from the client. The result will be sent back asynchronously. |
513 | /// </summary> | 521 | /// </summary> |
514 | /// <param name="userInfo"></param> | 522 | /// <param name="userInfo"></param> |
515 | /// <param name="transferRequest"></param> | 523 | /// <param name="transferRequest"></param> |
@@ -546,12 +554,21 @@ namespace OpenSim.Framework.Communications.Cache | |||
546 | RequestedAssets.Add(requestID, request); | 554 | RequestedAssets.Add(requestID, request); |
547 | m_assetServer.RequestAsset(requestID, false); | 555 | m_assetServer.RequestAsset(requestID, false); |
548 | } | 556 | } |
557 | |||
549 | return; | 558 | return; |
550 | } | 559 | } |
551 | //it is in our cache | 560 | |
561 | // It has an entry in our cache | ||
552 | AssetInfo asset = Assets[requestID]; | 562 | AssetInfo asset = Assets[requestID]; |
553 | 563 | ||
554 | // add to the AssetRequests list | 564 | // FIXME: We never tell the client about assets which do not exist when requested by this transfer mechanism, which can't be right. |
565 | if (null == asset) | ||
566 | { | ||
567 | m_log.DebugFormat("[ASSET CACHE]: Asset transfer request for asset which is {0} already known to be missing", requestID); | ||
568 | return; | ||
569 | } | ||
570 | |||
571 | // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list | ||
555 | AssetRequest req = new AssetRequest(); | 572 | AssetRequest req = new AssetRequest(); |
556 | req.RequestUser = userInfo; | 573 | req.RequestUser = userInfo; |
557 | req.RequestAssetID = requestID; | 574 | req.RequestAssetID = requestID; |
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index b16512c..db71079 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |||
@@ -78,7 +78,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
78 | { | 78 | { |
79 | //m_log.ErrorFormat("[ASSET SERVER]: Asset {0} not found by asset server", req.AssetID); | 79 | //m_log.ErrorFormat("[ASSET SERVER]: Asset {0} not found by asset server", req.AssetID); |
80 | 80 | ||
81 | m_receiver.AssetNotFound(req.AssetID); | 81 | m_receiver.AssetNotFound(req.AssetID, req.IsTexture); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/OpenSim/Framework/IAssetServer.cs b/OpenSim/Framework/IAssetServer.cs index 70feb74..0e89348 100644 --- a/OpenSim/Framework/IAssetServer.cs +++ b/OpenSim/Framework/IAssetServer.cs | |||
@@ -58,7 +58,8 @@ namespace OpenSim.Framework | |||
58 | /// Call back made when an asset server could not retrieve a requested asset | 58 | /// Call back made when an asset server could not retrieve a requested asset |
59 | /// </summary> | 59 | /// </summary> |
60 | /// <param name="assetID"></param> | 60 | /// <param name="assetID"></param> |
61 | void AssetNotFound(LLUUID assetID); | 61 | /// <param name="IsTexture"></param> |
62 | void AssetNotFound(LLUUID assetID, bool IsTexture); | ||
62 | } | 63 | } |
63 | 64 | ||
64 | public interface IAssetPlugin | 65 | public interface IAssetPlugin |