aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-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 'OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs36
1 files changed, 20 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index 103eb47..db66c83 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -33,6 +33,7 @@ using System.Timers;
33using log4net; 33using log4net;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Monitoring;
36using OpenSim.Framework.Serialization; 37using OpenSim.Framework.Serialization;
37using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
38using OpenSim.Services.Interfaces; 39using OpenSim.Services.Interfaces;
@@ -50,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
50 /// Method called when all the necessary assets for an archive request have been received. 51 /// Method called when all the necessary assets for an archive request have been received.
51 /// </summary> 52 /// </summary>
52 public delegate void AssetsRequestCallback( 53 public delegate void AssetsRequestCallback(
53 ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids); 54 ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut);
54 55
55 enum RequestState 56 enum RequestState
56 { 57 {
@@ -81,7 +82,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
81 /// <value> 82 /// <value>
82 /// uuids to request 83 /// uuids to request
83 /// </value> 84 /// </value>
84 protected IDictionary<UUID, AssetType> m_uuids; 85 protected IDictionary<UUID, sbyte> m_uuids;
85 86
86 /// <value> 87 /// <value>
87 /// Callback used when all the assets requested have been received. 88 /// Callback used when all the assets requested have been received.
@@ -115,7 +116,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
115 protected Dictionary<string, object> m_options; 116 protected Dictionary<string, object> m_options;
116 117
117 protected internal AssetsRequest( 118 protected internal AssetsRequest(
118 AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids, 119 AssetsArchiver assetsArchiver, IDictionary<UUID, sbyte> uuids,
119 IAssetService assetService, IUserAccountService userService, 120 IAssetService assetService, IUserAccountService userService,
120 UUID scope, Dictionary<string, object> options, 121 UUID scope, Dictionary<string, object> options,
121 AssetsRequestCallback assetsRequestCallback) 122 AssetsRequestCallback assetsRequestCallback)
@@ -143,19 +144,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
143 m_requestState = RequestState.Running; 144 m_requestState = RequestState.Running;
144 145
145 m_log.DebugFormat("[ARCHIVER]: AssetsRequest executed looking for {0} possible assets", m_repliesRequired); 146 m_log.DebugFormat("[ARCHIVER]: AssetsRequest executed looking for {0} possible assets", m_repliesRequired);
146 147
147 // We can stop here if there are no assets to fetch 148 // We can stop here if there are no assets to fetch
148 if (m_repliesRequired == 0) 149 if (m_repliesRequired == 0)
149 { 150 {
150 m_requestState = RequestState.Completed; 151 m_requestState = RequestState.Completed;
151 PerformAssetsRequestCallback(null); 152 PerformAssetsRequestCallback(false);
152 return; 153 return;
153 } 154 }
154 155
155 m_requestCallbackTimer.Enabled = true; 156 m_requestCallbackTimer.Enabled = true;
156 157
157 foreach (KeyValuePair<UUID, AssetType> kvp in m_uuids) 158 foreach (KeyValuePair<UUID, sbyte> kvp in m_uuids)
158 { 159 {
160// m_log.DebugFormat("[ARCHIVER]: Requesting asset {0}", kvp.Key);
161
159// m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback); 162// m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback);
160 AssetBase asset = m_assetService.Get(kvp.Key.ToString()); 163 AssetBase asset = m_assetService.Get(kvp.Key.ToString());
161 PreAssetRequestCallback(kvp.Key.ToString(), kvp.Value, asset); 164 PreAssetRequestCallback(kvp.Key.ToString(), kvp.Value, asset);
@@ -164,7 +167,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
164 167
165 protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) 168 protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args)
166 { 169 {
167 bool close = true; 170 bool timedOut = true;
168 171
169 try 172 try
170 { 173 {
@@ -174,7 +177,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
174 // the final request came in (assuming that such a thing is possible) 177 // the final request came in (assuming that such a thing is possible)
175 if (m_requestState == RequestState.Completed) 178 if (m_requestState == RequestState.Completed)
176 { 179 {
177 close = false; 180 timedOut = false;
178 return; 181 return;
179 } 182 }
180 183
@@ -223,8 +226,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
223 } 226 }
224 finally 227 finally
225 { 228 {
226 if (close) 229 if (timedOut)
227 m_assetsArchiver.ForceClose(); 230 WorkManager.RunInThread(PerformAssetsRequestCallback, true, "Archive Assets Request Callback");
228 } 231 }
229 } 232 }
230 233
@@ -233,9 +236,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
233 // Check for broken asset types and fix them with the AssetType gleaned by UuidGatherer 236 // Check for broken asset types and fix them with the AssetType gleaned by UuidGatherer
234 if (fetchedAsset != null && fetchedAsset.Type == (sbyte)AssetType.Unknown) 237 if (fetchedAsset != null && fetchedAsset.Type == (sbyte)AssetType.Unknown)
235 { 238 {
236 AssetType type = (AssetType)assetType; 239 m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, SLUtil.AssetTypeFromCode((sbyte)assetType));
237 m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, type); 240 fetchedAsset.Type = (sbyte)assetType;
238 fetchedAsset.Type = (sbyte)type;
239 } 241 }
240 242
241 AssetRequestCallback(fetchedAssetID, this, fetchedAsset); 243 AssetRequestCallback(fetchedAssetID, this, fetchedAsset);
@@ -294,7 +296,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
294 296
295 // We want to stop using the asset cache thread asap 297 // We want to stop using the asset cache thread asap
296 // as we now need to do the work of producing the rest of the archive 298 // as we now need to do the work of producing the rest of the archive
297 Util.FireAndForget(PerformAssetsRequestCallback); 299 WorkManager.RunInThread(PerformAssetsRequestCallback, false, "Archive Assets Request Callback");
298 } 300 }
299 else 301 else
300 { 302 {
@@ -315,9 +317,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
315 { 317 {
316 Culture.SetCurrentCulture(); 318 Culture.SetCurrentCulture();
317 319
320 Boolean timedOut = (Boolean)o;
321
318 try 322 try
319 { 323 {
320 m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids); 324 m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids, timedOut);
321 } 325 }
322 catch (Exception e) 326 catch (Exception e)
323 { 327 {
@@ -331,7 +335,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
331 if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home")) 335 if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home"))
332 { 336 {
333 //m_log.DebugFormat("[ARCHIVER]: Rewriting object data for {0}", asset.ID); 337 //m_log.DebugFormat("[ARCHIVER]: Rewriting object data for {0}", asset.ID);
334 string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), m_options["home"].ToString(), m_userAccountService, m_scopeID); 338 string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), string.Empty, m_options["home"].ToString(), m_userAccountService, m_scopeID);
335 asset.Data = Utils.StringToBytes(xml); 339 asset.Data = Utils.StringToBytes(xml);
336 } 340 }
337 return asset; 341 return asset;