diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index c9fce91..4215f97 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
74 | /// <value> | 74 | /// <value> |
75 | /// uuids to request | 75 | /// uuids to request |
76 | /// </value> | 76 | /// </value> |
77 | protected ICollection<UUID> m_uuids; | 77 | protected IDictionary<UUID, AssetType> m_uuids; |
78 | 78 | ||
79 | /// <value> | 79 | /// <value> |
80 | /// Callback used when all the assets requested have been received. | 80 | /// Callback used when all the assets requested have been received. |
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
104 | protected AssetsArchiver m_assetsArchiver; | 104 | protected AssetsArchiver m_assetsArchiver; |
105 | 105 | ||
106 | protected internal AssetsRequest( | 106 | protected internal AssetsRequest( |
107 | AssetsArchiver assetsArchiver, ICollection<UUID> uuids, | 107 | AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids, |
108 | IAssetService assetService, AssetsRequestCallback assetsRequestCallback) | 108 | IAssetService assetService, AssetsRequestCallback assetsRequestCallback) |
109 | { | 109 | { |
110 | m_assetsArchiver = assetsArchiver; | 110 | m_assetsArchiver = assetsArchiver; |
@@ -132,9 +132,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | 134 | ||
135 | foreach (UUID uuid in m_uuids) | 135 | foreach (KeyValuePair<UUID, AssetType> kvp in m_uuids) |
136 | { | 136 | { |
137 | m_assetService.Get(uuid.ToString(), this, AssetRequestCallback); | 137 | m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback); |
138 | } | 138 | } |
139 | 139 | ||
140 | m_requestCallbackTimer.Enabled = true; | 140 | m_requestCallbackTimer.Enabled = true; |
@@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
157 | // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure | 157 | // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure |
158 | // case anyway. | 158 | // case anyway. |
159 | List<UUID> uuids = new List<UUID>(); | 159 | List<UUID> uuids = new List<UUID>(); |
160 | foreach (UUID uuid in m_uuids) | 160 | foreach (UUID uuid in m_uuids.Keys) |
161 | { | 161 | { |
162 | uuids.Add(uuid); | 162 | uuids.Add(uuid); |
163 | } | 163 | } |
@@ -200,6 +200,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | protected void PreAssetRequestCallback(string fetchedAssetID, object assetType, AssetBase fetchedAsset) | ||
204 | { | ||
205 | // Check for broken asset types and fix them with the AssetType gleaned by UuidGatherer | ||
206 | if (fetchedAsset != null && fetchedAsset.Type == (sbyte)AssetType.Unknown) | ||
207 | { | ||
208 | AssetType type = (AssetType)assetType; | ||
209 | m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, type); | ||
210 | fetchedAsset.Type = (sbyte)type; | ||
211 | } | ||
212 | |||
213 | AssetRequestCallback(fetchedAssetID, this, fetchedAsset); | ||
214 | } | ||
215 | |||
203 | /// <summary> | 216 | /// <summary> |
204 | /// Called back by the asset cache when it has the asset | 217 | /// Called back by the asset cache when it has the asset |
205 | /// </summary> | 218 | /// </summary> |