diff options
author | Melanie Thielker | 2017-02-01 16:31:01 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-02-01 16:31:01 +0000 |
commit | a5151bb337cfee14dff6045d7f8e293201ae94ac (patch) | |
tree | f301338415da7160e48efcb4dc6cd1efc7faecaf /OpenSim/Services/Connectors | |
parent | Secure sim stats with an (optional) password. (diff) | |
download | opensim-SC_OLD-a5151bb337cfee14dff6045d7f8e293201ae94ac.zip opensim-SC_OLD-a5151bb337cfee14dff6045d7f8e293201ae94ac.tar.gz opensim-SC_OLD-a5151bb337cfee14dff6045d7f8e293201ae94ac.tar.bz2 opensim-SC_OLD-a5151bb337cfee14dff6045d7f8e293201ae94ac.tar.xz |
Refactor asset handling as per Ubit's suggestion
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r-- | OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 35 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | 20 |
2 files changed, 20 insertions, 35 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 9595e7b..810da2f 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -246,11 +246,7 @@ namespace OpenSim.Services.Connectors | |||
246 | 246 | ||
247 | if (m_Cache != null) | 247 | if (m_Cache != null) |
248 | { | 248 | { |
249 | bool negative; | 249 | if (!m_Cache.Get(id, out asset)) |
250 | |||
251 | asset = m_Cache.Get(id, out negative); | ||
252 | |||
253 | if (negative) | ||
254 | return null; | 250 | return null; |
255 | } | 251 | } |
256 | 252 | ||
@@ -283,21 +279,21 @@ namespace OpenSim.Services.Connectors | |||
283 | { | 279 | { |
284 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); | 280 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); |
285 | 281 | ||
286 | bool negative; | 282 | AssetBase asset = null; |
287 | if (m_Cache != null) | 283 | if (m_Cache != null) |
288 | return m_Cache.Get(id, out negative); | 284 | { |
285 | m_Cache.Get(id, out asset); | ||
286 | } | ||
289 | 287 | ||
290 | return null; | 288 | return asset; |
291 | } | 289 | } |
292 | 290 | ||
293 | public AssetMetadata GetMetadata(string id) | 291 | public AssetMetadata GetMetadata(string id) |
294 | { | 292 | { |
295 | if (m_Cache != null) | 293 | if (m_Cache != null) |
296 | { | 294 | { |
297 | bool negative; | 295 | AssetBase fullAsset; |
298 | AssetBase fullAsset = m_Cache.Get(id, out negative); | 296 | if (!m_Cache.Get(id, out fullAsset)) |
299 | |||
300 | if (negative) | ||
301 | return null; | 297 | return null; |
302 | 298 | ||
303 | if (fullAsset != null) | 299 | if (fullAsset != null) |
@@ -314,10 +310,8 @@ namespace OpenSim.Services.Connectors | |||
314 | { | 310 | { |
315 | if (m_Cache != null) | 311 | if (m_Cache != null) |
316 | { | 312 | { |
317 | bool negative; | 313 | AssetBase fullAsset; |
318 | AssetBase fullAsset = m_Cache.Get(id, out negative); | 314 | if (!m_Cache.Get(id, out fullAsset)) |
319 | |||
320 | if (negative) | ||
321 | return null; | 315 | return null; |
322 | 316 | ||
323 | if (fullAsset != null) | 317 | if (fullAsset != null) |
@@ -407,11 +401,7 @@ namespace OpenSim.Services.Connectors | |||
407 | AssetBase asset = null; | 401 | AssetBase asset = null; |
408 | if (m_Cache != null) | 402 | if (m_Cache != null) |
409 | { | 403 | { |
410 | bool negative; | 404 | if (!m_Cache.Get(id, out asset)) |
411 | |||
412 | asset = m_Cache.Get(id, out negative); | ||
413 | |||
414 | if (negative) | ||
415 | return false; | 405 | return false; |
416 | } | 406 | } |
417 | 407 | ||
@@ -613,9 +603,8 @@ namespace OpenSim.Services.Connectors | |||
613 | { | 603 | { |
614 | AssetBase asset = null; | 604 | AssetBase asset = null; |
615 | 605 | ||
616 | bool negative; | ||
617 | if (m_Cache != null) | 606 | if (m_Cache != null) |
618 | asset = m_Cache.Get(id, out negative); | 607 | m_Cache.Get(id, out asset); |
619 | 608 | ||
620 | if (asset == null) | 609 | if (asset == null) |
621 | { | 610 | { |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index af5f69a..953bc2a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -136,9 +136,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
136 | // Cache fetch | 136 | // Cache fetch |
137 | if (m_cache != null) | 137 | if (m_cache != null) |
138 | { | 138 | { |
139 | bool negative; | 139 | AssetBase asset; |
140 | AssetBase asset = m_cache.Get(id, out negative); | 140 | if (!m_cache.Get(id, out asset)) |
141 | if (negative) | ||
142 | return null; | 141 | return null; |
143 | if (asset != null) | 142 | if (asset != null) |
144 | return asset; | 143 | return asset; |
@@ -150,9 +149,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
150 | 149 | ||
151 | public AssetBase GetCached(string id) | 150 | public AssetBase GetCached(string id) |
152 | { | 151 | { |
153 | bool negative; | 152 | AssetBase asset; |
154 | if (m_cache != null) | 153 | if (m_cache != null) |
155 | return m_cache.Get(id, out negative); | 154 | m_cache.Get(id, out asset); |
156 | 155 | ||
157 | return null; | 156 | return null; |
158 | } | 157 | } |
@@ -173,9 +172,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
173 | // Cache fetch | 172 | // Cache fetch |
174 | if (m_cache != null) | 173 | if (m_cache != null) |
175 | { | 174 | { |
176 | bool negative; | 175 | AssetBase asset; |
177 | AssetBase asset = m_cache.Get(id, out negative); | 176 | if (!m_cache.Get(id, out asset)) |
178 | if (negative) | ||
179 | return null; | 177 | return null; |
180 | if (asset != null) | 178 | if (asset != null) |
181 | return asset.Metadata; | 179 | return asset.Metadata; |
@@ -219,10 +217,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
219 | // Cache fetch | 217 | // Cache fetch |
220 | if (m_cache != null) | 218 | if (m_cache != null) |
221 | { | 219 | { |
222 | bool negative; | 220 | AssetBase asset; |
223 | AssetBase asset = m_cache.Get(id, out negative); | 221 | if (!m_cache.Get(id, out asset)) |
224 | |||
225 | if (negative) | ||
226 | return false; | 222 | return false; |
227 | 223 | ||
228 | if (asset != null) | 224 | if (asset != null) |