aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
diff options
context:
space:
mode:
authorJohn Hurliman2010-03-15 14:17:17 -0700
committerJohn Hurliman2010-03-15 14:17:17 -0700
commit33f5d0d1e90c3e63e06a200043a01c32768335c1 (patch)
tree8be352ceace25400a51c3a26ca1c2ce654788e55 /OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.zip
opensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.tar.gz
opensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.tar.bz2
opensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.tar.xz
* UuidGatherer now tracks asset types for assets it discovers. The asset types are inferred from context
* OAR saving will attempt to correct unknown asset types before writing broken assets to the OAR file
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs23
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>