From 3146f4bae0d6c0b190fb6b8477c690046a1c79af Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 18 Aug 2011 23:36:43 +0100 Subject: [PATCH] Don't need to try both AssetService.Get and GetCached in GetMesh since Get always calls GetCached and code paths were identical --- .../Handlers/GetMesh/GetMeshHandler.cs | 45 ++++--------------- OpenSim/Services/Interfaces/IAssetService.cs | 8 +++- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs index c60abb1fb1..720640e260 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs @@ -57,7 +57,6 @@ namespace OpenSim.Capabilities.Handlers public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) { - Hashtable responsedata = new Hashtable(); responsedata["int_response_code"] = 400; //501; //410; //404; responsedata["content_type"] = "text/plain"; @@ -69,7 +68,6 @@ namespace OpenSim.Capabilities.Handlers if (request.ContainsKey("mesh_id")) meshStr = request["mesh_id"].ToString(); - UUID meshID = UUID.Zero; if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID)) { @@ -82,12 +80,11 @@ namespace OpenSim.Capabilities.Handlers return responsedata; } - AssetBase mesh; - // Only try to fetch locally cached textures. Misses are redirected - mesh = m_assetService.GetCached(meshID.ToString()); + AssetBase mesh = m_assetService.Get(meshID.ToString()); + if (mesh != null) { - if (mesh.Type == (SByte)AssetType.Mesh) + if (mesh.Type == (SByte)AssetType.Mesh) { responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); responsedata["content_type"] = "application/vnd.ll.mesh"; @@ -105,39 +102,15 @@ namespace OpenSim.Capabilities.Handlers } else { - mesh = m_assetService.Get(meshID.ToString()); - if (mesh != null) - { - if (mesh.Type == (SByte)AssetType.Mesh) - { - responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); - responsedata["content_type"] = "application/vnd.ll.mesh"; - responsedata["int_response_code"] = 200; - } - // Optionally add additional mesh types here - else - { - responsedata["int_response_code"] = 404; //501; //410; //404; - responsedata["content_type"] = "text/plain"; - responsedata["keepalive"] = false; - responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh."; - return responsedata; - } - } - - else - { - responsedata["int_response_code"] = 404; //501; //410; //404; - responsedata["content_type"] = "text/plain"; - responsedata["keepalive"] = false; - responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; - return responsedata; - } + responsedata["int_response_code"] = 404; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; + return responsedata; } - } return responsedata; } } -} +} \ No newline at end of file diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs index 1ac1cec358..80494f177a 100644 --- a/OpenSim/Services/Interfaces/IAssetService.cs +++ b/OpenSim/Services/Interfaces/IAssetService.cs @@ -56,7 +56,7 @@ namespace OpenSim.Services.Interfaces byte[] GetData(string id); /// - /// Synchronously fetches an asset from the local cache only + /// Synchronously fetches an asset from the local cache only. /// /// Asset ID /// The fetched asset, or null if it did not exist in the local cache @@ -75,7 +75,9 @@ namespace OpenSim.Services.Interfaces /// /// Creates a new asset /// - /// Returns a random ID if none is passed into it + /// + /// Returns a random ID if none is passed via the asset argument. + /// /// /// string Store(AssetBase asset); @@ -83,7 +85,9 @@ namespace OpenSim.Services.Interfaces /// /// Update an asset's content /// + /// /// Attachments and bare scripts need this!! + /// /// /// ///