diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index d221d68..7fcfc74 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -69,6 +69,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
69 | get { return "HGAssetBroker"; } | 69 | get { return "HGAssetBroker"; } |
70 | } | 70 | } |
71 | 71 | ||
72 | public HGAssetBroker() {} | ||
73 | |||
74 | public HGAssetBroker(IConfigSource config) | ||
75 | { | ||
76 | Initialise(config); | ||
77 | } | ||
78 | |||
72 | public void Initialise(IConfigSource source) | 79 | public void Initialise(IConfigSource source) |
73 | { | 80 | { |
74 | IConfig moduleConfig = source.Configs["Modules"]; | 81 | IConfig moduleConfig = source.Configs["Modules"]; |
@@ -288,7 +295,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
288 | 295 | ||
289 | if (asset != null) | 296 | if (asset != null) |
290 | { | 297 | { |
291 | Util.FireAndForget(delegate { handler(id, sender, asset); }); | 298 | Util.FireAndForget(delegate { handler(id, sender, asset); }, null, "HGAssetBroker.GotFromCache"); |
292 | return true; | 299 | return true; |
293 | } | 300 | } |
294 | 301 | ||
@@ -312,6 +319,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
312 | } | 319 | } |
313 | } | 320 | } |
314 | 321 | ||
322 | public virtual bool[] AssetsExist(string[] ids) | ||
323 | { | ||
324 | int numHG = 0; | ||
325 | foreach (string id in ids) | ||
326 | { | ||
327 | if (IsHG(id)) | ||
328 | ++numHG; | ||
329 | } | ||
330 | |||
331 | if (numHG == 0) | ||
332 | return m_GridService.AssetsExist(ids); | ||
333 | else if (numHG == ids.Length) | ||
334 | return m_HGService.AssetsExist(ids); | ||
335 | else | ||
336 | throw new Exception("[HG ASSET CONNECTOR]: AssetsExist: all the assets must be either local or foreign"); | ||
337 | } | ||
338 | |||
315 | public string Store(AssetBase asset) | 339 | public string Store(AssetBase asset) |
316 | { | 340 | { |
317 | bool isHG = IsHG(asset.ID); | 341 | bool isHG = IsHG(asset.ID); |
@@ -322,14 +346,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
322 | // a copy of the local asset. | 346 | // a copy of the local asset. |
323 | m_Cache.Cache(asset); | 347 | m_Cache.Cache(asset); |
324 | 348 | ||
325 | if (asset.Temporary || asset.Local) | 349 | if (asset.Local) |
326 | { | 350 | { |
327 | if (m_Cache != null) | 351 | if (m_Cache != null) |
328 | m_Cache.Cache(asset); | 352 | m_Cache.Cache(asset); |
329 | return asset.ID; | 353 | return asset.ID; |
330 | } | 354 | } |
331 | 355 | ||
332 | string id = string.Empty; | 356 | string id; |
333 | if (IsHG(asset.ID)) | 357 | if (IsHG(asset.ID)) |
334 | { | 358 | { |
335 | if (m_AssetPerms.AllowedExport(asset.Type)) | 359 | if (m_AssetPerms.AllowedExport(asset.Type)) |
@@ -340,18 +364,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
340 | else | 364 | else |
341 | id = m_GridService.Store(asset); | 365 | id = m_GridService.Store(asset); |
342 | 366 | ||
343 | if (id != String.Empty) | 367 | if (String.IsNullOrEmpty(id)) |
344 | { | 368 | return string.Empty; |
345 | // Placing this here, so that this work with old asset servers that don't send any reply back | 369 | |
346 | // SynchronousRestObjectRequester returns somethins that is not an empty string | 370 | asset.ID = id; |
347 | if (id != null) | ||
348 | asset.ID = id; | ||
349 | 371 | ||
350 | if (m_Cache != null) | 372 | if (m_Cache != null) |
351 | m_Cache.Cache(asset); | 373 | m_Cache.Cache(asset); |
352 | } | ||
353 | return id; | ||
354 | 374 | ||
375 | return id; | ||
355 | } | 376 | } |
356 | 377 | ||
357 | public bool UpdateContent(string id, byte[] data) | 378 | public bool UpdateContent(string id, byte[] data) |