aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-18 23:36:43 +0100
committerJustin Clark-Casey (justincc)2011-08-18 23:36:43 +0100
commit3146f4bae0d6c0b190fb6b8477c690046a1c79af (patch)
tree40c094016c98abab9b462a8b762bbd868d9d791b /OpenSim
parentrefactor: fold CreateSceneViewer() back into ScenePresence constructor (diff)
downloadopensim-SC_OLD-3146f4bae0d6c0b190fb6b8477c690046a1c79af.zip
opensim-SC_OLD-3146f4bae0d6c0b190fb6b8477c690046a1c79af.tar.gz
opensim-SC_OLD-3146f4bae0d6c0b190fb6b8477c690046a1c79af.tar.bz2
opensim-SC_OLD-3146f4bae0d6c0b190fb6b8477c690046a1c79af.tar.xz
Don't need to try both AssetService.Get and GetCached in GetMesh since Get always calls GetCached and code paths were identical
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs45
-rw-r--r--OpenSim/Services/Interfaces/IAssetService.cs8
2 files changed, 15 insertions, 38 deletions
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
index c60abb1..720640e 100644
--- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
+++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs
@@ -57,7 +57,6 @@ namespace OpenSim.Capabilities.Handlers
57 57
58 public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) 58 public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap)
59 { 59 {
60
61 Hashtable responsedata = new Hashtable(); 60 Hashtable responsedata = new Hashtable();
62 responsedata["int_response_code"] = 400; //501; //410; //404; 61 responsedata["int_response_code"] = 400; //501; //410; //404;
63 responsedata["content_type"] = "text/plain"; 62 responsedata["content_type"] = "text/plain";
@@ -69,7 +68,6 @@ namespace OpenSim.Capabilities.Handlers
69 if (request.ContainsKey("mesh_id")) 68 if (request.ContainsKey("mesh_id"))
70 meshStr = request["mesh_id"].ToString(); 69 meshStr = request["mesh_id"].ToString();
71 70
72
73 UUID meshID = UUID.Zero; 71 UUID meshID = UUID.Zero;
74 if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID)) 72 if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID))
75 { 73 {
@@ -82,12 +80,11 @@ namespace OpenSim.Capabilities.Handlers
82 return responsedata; 80 return responsedata;
83 } 81 }
84 82
85 AssetBase mesh; 83 AssetBase mesh = m_assetService.Get(meshID.ToString());
86 // Only try to fetch locally cached textures. Misses are redirected 84
87 mesh = m_assetService.GetCached(meshID.ToString());
88 if (mesh != null) 85 if (mesh != null)
89 { 86 {
90 if (mesh.Type == (SByte)AssetType.Mesh) 87 if (mesh.Type == (SByte)AssetType.Mesh)
91 { 88 {
92 responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); 89 responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
93 responsedata["content_type"] = "application/vnd.ll.mesh"; 90 responsedata["content_type"] = "application/vnd.ll.mesh";
@@ -105,39 +102,15 @@ namespace OpenSim.Capabilities.Handlers
105 } 102 }
106 else 103 else
107 { 104 {
108 mesh = m_assetService.Get(meshID.ToString()); 105 responsedata["int_response_code"] = 404; //501; //410; //404;
109 if (mesh != null) 106 responsedata["content_type"] = "text/plain";
110 { 107 responsedata["keepalive"] = false;
111 if (mesh.Type == (SByte)AssetType.Mesh) 108 responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
112 { 109 return responsedata;
113 responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data);
114 responsedata["content_type"] = "application/vnd.ll.mesh";
115 responsedata["int_response_code"] = 200;
116 }
117 // Optionally add additional mesh types here
118 else
119 {
120 responsedata["int_response_code"] = 404; //501; //410; //404;
121 responsedata["content_type"] = "text/plain";
122 responsedata["keepalive"] = false;
123 responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh.";
124 return responsedata;
125 }
126 }
127
128 else
129 {
130 responsedata["int_response_code"] = 404; //501; //410; //404;
131 responsedata["content_type"] = "text/plain";
132 responsedata["keepalive"] = false;
133 responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!";
134 return responsedata;
135 }
136 } 110 }
137
138 } 111 }
139 112
140 return responsedata; 113 return responsedata;
141 } 114 }
142 } 115 }
143} 116} \ No newline at end of file
diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs
index 1ac1cec..80494f1 100644
--- a/OpenSim/Services/Interfaces/IAssetService.cs
+++ b/OpenSim/Services/Interfaces/IAssetService.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Services.Interfaces
56 byte[] GetData(string id); 56 byte[] GetData(string id);
57 57
58 /// <summary> 58 /// <summary>
59 /// Synchronously fetches an asset from the local cache only 59 /// Synchronously fetches an asset from the local cache only.
60 /// </summary> 60 /// </summary>
61 /// <param name="id">Asset ID</param> 61 /// <param name="id">Asset ID</param>
62 /// <returns>The fetched asset, or null if it did not exist in the local cache</returns> 62 /// <returns>The fetched asset, or null if it did not exist in the local cache</returns>
@@ -75,7 +75,9 @@ namespace OpenSim.Services.Interfaces
75 /// <summary> 75 /// <summary>
76 /// Creates a new asset 76 /// Creates a new asset
77 /// </summary> 77 /// </summary>
78 /// Returns a random ID if none is passed into it 78 /// <remarks>
79 /// Returns a random ID if none is passed via the asset argument.
80 /// </remarks>
79 /// <param name="asset"></param> 81 /// <param name="asset"></param>
80 /// <returns></returns> 82 /// <returns></returns>
81 string Store(AssetBase asset); 83 string Store(AssetBase asset);
@@ -83,7 +85,9 @@ namespace OpenSim.Services.Interfaces
83 /// <summary> 85 /// <summary>
84 /// Update an asset's content 86 /// Update an asset's content
85 /// </summary> 87 /// </summary>
88 /// <remarks>
86 /// Attachments and bare scripts need this!! 89 /// Attachments and bare scripts need this!!
90 /// </remarks>
87 /// <param name="id"> </param> 91 /// <param name="id"> </param>
88 /// <param name="data"></param> 92 /// <param name="data"></param>
89 /// <returns></returns> 93 /// <returns></returns>