diff options
author | Justin Clark-Casey (justincc) | 2011-08-17 23:24:41 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-17 23:24:41 +0100 |
commit | 6b51d8a10e44eed7c39b58aab256789ab188ecca (patch) | |
tree | 8194d49b020d64dbf13315b1500e880a3b30d7c3 | |
parent | For now, supress 'OH NOES' warnings given by HGInventoryBroker.CacheInventory... (diff) | |
download | opensim-SC-6b51d8a10e44eed7c39b58aab256789ab188ecca.zip opensim-SC-6b51d8a10e44eed7c39b58aab256789ab188ecca.tar.gz opensim-SC-6b51d8a10e44eed7c39b58aab256789ab188ecca.tar.bz2 opensim-SC-6b51d8a10e44eed7c39b58aab256789ab188ecca.tar.xz |
In the asset service, check that an asset exists before attempting to store it.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 9 | ||||
-rw-r--r-- | OpenSim/Services/AssetService/AssetService.cs | 10 |
2 files changed, 13 insertions, 6 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index e740232..a743479 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -251,12 +251,14 @@ namespace OpenSim.Data.MySQL | |||
251 | } | 251 | } |
252 | 252 | ||
253 | /// <summary> | 253 | /// <summary> |
254 | /// check if the asset UUID exist in database | 254 | /// Check if the asset exists in the database |
255 | /// </summary> | 255 | /// </summary> |
256 | /// <param name="uuid">The asset UUID</param> | 256 | /// <param name="uuid">The asset UUID</param> |
257 | /// <returns>true if exist.</returns> | 257 | /// <returns>true if it exists, false otherwise.</returns> |
258 | override public bool ExistsAsset(UUID uuid) | 258 | override public bool ExistsAsset(UUID uuid) |
259 | { | 259 | { |
260 | // m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid); | ||
261 | |||
260 | bool assetExists = false; | 262 | bool assetExists = false; |
261 | 263 | ||
262 | lock (m_dbLock) | 264 | lock (m_dbLock) |
@@ -273,7 +275,10 @@ namespace OpenSim.Data.MySQL | |||
273 | using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) | 275 | using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) |
274 | { | 276 | { |
275 | if (dbReader.Read()) | 277 | if (dbReader.Read()) |
278 | { | ||
279 | // m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid); | ||
276 | assetExists = true; | 280 | assetExists = true; |
281 | } | ||
277 | } | 282 | } |
278 | } | 283 | } |
279 | catch (Exception e) | 284 | catch (Exception e) |
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index c7a259d..d40aa4b 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -174,10 +174,12 @@ namespace OpenSim.Services.AssetService | |||
174 | 174 | ||
175 | public virtual string Store(AssetBase asset) | 175 | public virtual string Store(AssetBase asset) |
176 | { | 176 | { |
177 | // m_log.DebugFormat( | 177 | if (!m_Database.ExistsAsset(asset.FullID)) |
178 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); | 178 | { |
179 | 179 | // m_log.DebugFormat( | |
180 | m_Database.StoreAsset(asset); | 180 | // "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); |
181 | m_Database.StoreAsset(asset); | ||
182 | } | ||
181 | 183 | ||
182 | return asset.ID; | 184 | return asset.ID; |
183 | } | 185 | } |