From 4fa0cbdfbb9b8c1b60c8f23edb6301962afd8533 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 8 May 2008 05:35:01 +0000 Subject: * You can haz more spring cleaning. * Eventually this codebase will be clean. >_> --- OpenSim/Framework/ClientManager.cs | 3 +- .../Framework/Communications/Cache/AssetCache.cs | 74 ++++------------------ 2 files changed, 15 insertions(+), 62 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs index 4f21ab6..272cf2b 100644 --- a/OpenSim/Framework/ClientManager.cs +++ b/OpenSim/Framework/ClientManager.cs @@ -188,8 +188,7 @@ namespace OpenSim.Framework } packet.Effect = effectBlock.ToArray(); - // Wasteful, I know - IClientAPI[] LocalClients = new IClientAPI[0]; + IClientAPI[] LocalClients; lock (m_clients) { LocalClients = new IClientAPI[m_clients.Count]; diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 69e0437..fddf01d 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -334,18 +334,9 @@ namespace OpenSim.Framework.Communications.Cache /// public void AddAsset(AssetBase asset) { - string temporary = asset.Temporary ? "temporary" : String.Empty; - string type = asset.Type == 0 ? "texture" : "asset"; - - string result = "Ignored"; - if (asset.Type == 0) { - if (Textures.ContainsKey(asset.FullID)) - { - result = "Duplicate ignored."; - } - else + if (!Textures.ContainsKey(asset.FullID)) { TextureImage textur = new TextureImage(asset); Textures.Add(textur.FullID, textur); @@ -353,24 +344,15 @@ namespace OpenSim.Framework.Communications.Cache if (StatsManager.SimExtraStats != null) StatsManager.SimExtraStats.AddTexture(textur); - if (asset.Temporary) - { - result = "Added to cache"; - } - else + if (!asset.Temporary) { m_assetServer.StoreAndCommitAsset(asset); - result = "Added to server"; } } } else { - if (Assets.ContainsKey(asset.FullID)) - { - result = "Duplicate ignored."; - } - else + if (!Assets.ContainsKey(asset.FullID)) { AssetInfo assetInf = new AssetInfo(asset); Assets.Add(assetInf.FullID, assetInf); @@ -378,29 +360,17 @@ namespace OpenSim.Framework.Communications.Cache if (StatsManager.SimExtraStats != null) StatsManager.SimExtraStats.AddAsset(assetInf); - if (asset.Temporary) - { - result = "Added to cache"; - } - else + if (!asset.Temporary) { m_assetServer.StoreAndCommitAsset(asset); - result = "Added to server"; } } } -#if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result); -#endif } // See IAssetReceiver public void AssetReceived(AssetBase asset, bool IsTexture) { -#if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: Received {0} [{1}]", IsTexture ? "texture" : "asset", asset.FullID); -#endif - if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server { //check if it is a texture or not @@ -411,13 +381,7 @@ namespace OpenSim.Framework.Communications.Cache if (IsTexture) { TextureImage image = new TextureImage(asset); - if (Textures.ContainsKey(image.FullID)) - { -#if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: There's already an texture {0} in memory. Skipping.", asset.FullID); -#endif - } - else + if (!Textures.ContainsKey(image.FullID)) { Textures.Add(image.FullID, image); @@ -430,13 +394,7 @@ namespace OpenSim.Framework.Communications.Cache else { AssetInfo assetInf = new AssetInfo(asset); - if (Assets.ContainsKey(assetInf.FullID)) - { -#if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: There's already an asset {0} in memory. Skipping.", asset.FullID); -#endif - } - else + if (!Assets.ContainsKey(assetInf.FullID)) { Assets.Add(assetInf.FullID, assetInf); @@ -446,18 +404,14 @@ namespace OpenSim.Framework.Communications.Cache } if (RequestedAssets.ContainsKey(assetInf.FullID)) - { - #if DEBUG - //m_log.DebugFormat("[ASSET CACHE]: Moving {0} from RequestedAssets to AssetRequests", asset.FullID); - #endif - - AssetRequest req = RequestedAssets[assetInf.FullID]; - req.AssetInf = assetInf; - req.NumPackets = CalculateNumPackets(assetInf.Data); - - RequestedAssets.Remove(assetInf.FullID); - AssetRequests.Add(req); - } + { + AssetRequest req = RequestedAssets[assetInf.FullID]; + req.AssetInf = assetInf; + req.NumPackets = CalculateNumPackets(assetInf.Data); + + RequestedAssets.Remove(assetInf.FullID); + AssetRequests.Add(req); + } } } -- cgit v1.1