From e978d00914a25c12cc03efd597125e2948526681 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 27 Feb 2008 21:11:01 +0000 Subject: After seeing sdague do his happy dance over trunk working "the best he has ever seen". I'm not sure I should be doing this commit, but oh well. So anyway, it moves the Asset downloading (packet sending) to a module (AssetDownloadModule). So now at last, AssetCache should be just dealing with fetching assets from the asset server and caching them. --- .../Framework/Communications/Cache/AssetCache.cs | 35 +++++++++++----------- OpenSim/Framework/IClientAPI.cs | 3 ++ 2 files changed, 21 insertions(+), 17 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 061b857..abb7ce1 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -69,12 +69,12 @@ namespace OpenSim.Framework.Communications.Cache /// /// Assets requests which are waiting for asset server data. This includes texture requests /// - private Dictionary RequestedAssets; + // private Dictionary RequestedAssets; /// /// Asset requests with data which are ready to be sent back to requesters. This includes textures. /// - private List AssetRequests; + // private List AssetRequests; /// @@ -84,7 +84,7 @@ namespace OpenSim.Framework.Communications.Cache private readonly IAssetServer m_assetServer; - private readonly Thread m_assetCacheThread; + // private readonly Thread m_assetCacheThread; /// /// Report statistical data. @@ -94,8 +94,8 @@ namespace OpenSim.Framework.Communications.Cache m_log.InfoFormat("Assets:{0} Textures:{1} AssetRequests:{2} RequestedAssets:{3} RequestLists:{4}", Assets.Count, Textures.Count, - AssetRequests.Count, - RequestedAssets.Count, + // AssetRequests.Count, + // RequestedAssets.Count, RequestLists.Count); int temporaryImages = 0; @@ -150,9 +150,9 @@ namespace OpenSim.Framework.Communications.Cache { Assets = new Dictionary(); Textures = new Dictionary(); - AssetRequests = new List(); + // AssetRequests = new List(); - RequestedAssets = new Dictionary(); + // RequestedAssets = new Dictionary(); RequestLists = new Dictionary(); } @@ -168,18 +168,18 @@ namespace OpenSim.Framework.Communications.Cache m_assetServer = assetServer; m_assetServer.SetReceiver(this); - m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); - m_assetCacheThread.Name = "AssetCacheThread"; - m_assetCacheThread.IsBackground = true; - m_assetCacheThread.Start(); - OpenSim.Framework.ThreadTracker.Add(m_assetCacheThread); + // m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); + // m_assetCacheThread.Name = "AssetCacheThread"; + // m_assetCacheThread.IsBackground = true; + // m_assetCacheThread.Start(); + // OpenSim.Framework.ThreadTracker.Add(m_assetCacheThread); } /// /// Process the asset queue which holds data which is packeted up and sent /// directly back to the client. /// - public void RunAssetManager() + /* public void RunAssetManager() { while (true) { @@ -193,7 +193,7 @@ namespace OpenSim.Framework.Communications.Cache m_log.Error("[ASSET CACHE]: " + e.ToString()); } } - } + }*/ /// /// Only get an asset if we already have it in the cache. @@ -449,7 +449,7 @@ namespace OpenSim.Framework.Communications.Cache StatsManager.SimExtraStats.AddAsset(assetInf); } - if (RequestedAssets.ContainsKey(assetInf.FullID)) + /* if (RequestedAssets.ContainsKey(assetInf.FullID)) { #if DEBUG //m_log.DebugFormat("[ASSET CACHE]: Moving {0} from RequestedAssets to AssetRequests", asset.FullID); @@ -461,7 +461,7 @@ namespace OpenSim.Framework.Communications.Cache RequestedAssets.Remove(assetInf.FullID); AssetRequests.Add(req); - } + }*/ } } @@ -541,6 +541,7 @@ namespace OpenSim.Framework.Communications.Cache } + /* /// /// Calculate the number of packets required to send the asset to the client. /// @@ -734,7 +735,7 @@ namespace OpenSim.Framework.Communications.Cache { } } - + */ public class AssetInfo : AssetBase { diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 2635a23..511bbad 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -390,6 +390,8 @@ namespace OpenSim.Framework public delegate void RemoveInventoryFolder( IClientAPI remoteClient, LLUUID folderID); + public delegate void RequestAsset(IClientAPI remoteClient, TransferRequestPacket transferRequest); + public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID); public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID); @@ -503,6 +505,7 @@ namespace OpenSim.Framework event RezScript OnRezScript; event UpdateTaskInventory OnUpdateTaskInventory; event RemoveTaskInventory OnRemoveTaskItem; + event RequestAsset OnRequestAsset; event UUIDNameRequest OnNameFromUUIDRequest; -- cgit v1.1