diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index 034e692..e31be21 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -219,11 +219,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
219 | else | 219 | else |
220 | asset = m_GridService.Get(id); | 220 | asset = m_GridService.Get(id); |
221 | 221 | ||
222 | if (asset != null) | 222 | if (m_Cache != null) |
223 | { | 223 | m_Cache.Cache(asset); |
224 | if (m_Cache != null) | ||
225 | m_Cache.Cache(asset); | ||
226 | } | ||
227 | 224 | ||
228 | return asset; | 225 | return asset; |
229 | } | 226 | } |
@@ -273,18 +270,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
273 | } | 270 | } |
274 | 271 | ||
275 | if (IsHG(id)) | 272 | if (IsHG(id)) |
276 | asset = m_HGService.Get(id); | 273 | return m_HGService.GetData(id); |
277 | else | 274 | else |
278 | asset = m_GridService.Get(id); | 275 | return m_GridService.GetData(id); |
279 | |||
280 | if (asset != null) | ||
281 | { | ||
282 | if (m_Cache != null) | ||
283 | m_Cache.Cache(asset); | ||
284 | return asset.Data; | ||
285 | } | ||
286 | 276 | ||
287 | return null; | ||
288 | } | 277 | } |
289 | 278 | ||
290 | public bool Get(string id, Object sender, AssetRetrieved handler) | 279 | public bool Get(string id, Object sender, AssetRetrieved handler) |
@@ -304,7 +293,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
304 | { | 293 | { |
305 | return m_HGService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) | 294 | return m_HGService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) |
306 | { | 295 | { |
307 | if (a != null && m_Cache != null) | 296 | if (m_Cache != null) |
308 | m_Cache.Cache(a); | 297 | m_Cache.Cache(a); |
309 | handler(assetID, s, a); | 298 | handler(assetID, s, a); |
310 | }); | 299 | }); |
@@ -313,7 +302,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
313 | { | 302 | { |
314 | return m_GridService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) | 303 | return m_GridService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) |
315 | { | 304 | { |
316 | if (a != null && m_Cache != null) | 305 | if (m_Cache != null) |
317 | m_Cache.Cache(a); | 306 | m_Cache.Cache(a); |
318 | handler(assetID, s, a); | 307 | handler(assetID, s, a); |
319 | }); | 308 | }); |
@@ -331,12 +320,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
331 | m_Cache.Cache(asset); | 320 | m_Cache.Cache(asset); |
332 | 321 | ||
333 | if (asset.Temporary || asset.Local) | 322 | if (asset.Temporary || asset.Local) |
323 | { | ||
324 | if (m_Cache != null) | ||
325 | m_Cache.Cache(asset); | ||
334 | return asset.ID; | 326 | return asset.ID; |
327 | } | ||
335 | 328 | ||
329 | string id = string.Empty; | ||
336 | if (IsHG(asset.ID)) | 330 | if (IsHG(asset.ID)) |
337 | return m_HGService.Store(asset); | 331 | id = m_HGService.Store(asset); |
338 | else | 332 | else |
339 | return m_GridService.Store(asset); | 333 | id = m_GridService.Store(asset); |
334 | |||
335 | if (id != String.Empty) | ||
336 | { | ||
337 | // Placing this here, so that this work with old asset servers that don't send any reply back | ||
338 | // SynchronousRestObjectRequester returns somethins that is not an empty string | ||
339 | if (id != null) | ||
340 | asset.ID = id; | ||
341 | |||
342 | if (m_Cache != null) | ||
343 | m_Cache.Cache(asset); | ||
344 | } | ||
345 | return id; | ||
346 | |||
340 | } | 347 | } |
341 | 348 | ||
342 | public bool UpdateContent(string id, byte[] data) | 349 | public bool UpdateContent(string id, byte[] data) |
@@ -363,10 +370,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
363 | if (m_Cache != null) | 370 | if (m_Cache != null) |
364 | m_Cache.Expire(id); | 371 | m_Cache.Expire(id); |
365 | 372 | ||
373 | bool result = false; | ||
366 | if (IsHG(id)) | 374 | if (IsHG(id)) |
367 | return m_HGService.Delete(id); | 375 | result = m_HGService.Delete(id); |
368 | else | 376 | else |
369 | return m_GridService.Delete(id); | 377 | result = m_GridService.Delete(id); |
378 | |||
379 | if (result && m_Cache != null) | ||
380 | m_Cache.Expire(id); | ||
381 | |||
382 | return result; | ||
370 | } | 383 | } |
371 | 384 | ||
372 | #region IHyperAssetService | 385 | #region IHyperAssetService |