diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 8ee7dbc..80d3f62 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -66,6 +66,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
66 | /// <value>The gathered uuids.</value> | 66 | /// <value>The gathered uuids.</value> |
67 | public IDictionary<UUID, sbyte> GatheredUuids { get; private set; } | 67 | public IDictionary<UUID, sbyte> GatheredUuids { get; private set; } |
68 | public HashSet<UUID> FailedUUIDs { get; private set; } | 68 | public HashSet<UUID> FailedUUIDs { get; private set; } |
69 | public HashSet<UUID> UncertainAssetsUUIDs { get; private set; } | ||
70 | public int possibleNotAssetCount { get; set; } | ||
69 | public int ErrorCount { get; private set; } | 71 | public int ErrorCount { get; private set; } |
70 | /// <summary> | 72 | /// <summary> |
71 | /// Gets the next UUID to inspect. | 73 | /// Gets the next UUID to inspect. |
@@ -93,8 +95,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
93 | /// <param name="assetService"> | 95 | /// <param name="assetService"> |
94 | /// Asset service. | 96 | /// Asset service. |
95 | /// </param> | 97 | /// </param> |
96 | public UuidGatherer(IAssetService assetService) : this(assetService, new Dictionary<UUID, sbyte>(), new HashSet <UUID>()) {} | 98 | public UuidGatherer(IAssetService assetService) : this(assetService, new Dictionary<UUID, sbyte>(), |
97 | public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector) : this(assetService, collector, new HashSet <UUID>()) {} | 99 | new HashSet <UUID>(),new HashSet <UUID>()) {} |
100 | public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector) : this(assetService, collector, | ||
101 | new HashSet <UUID>(), new HashSet <UUID>()) {} | ||
98 | 102 | ||
99 | /// <summary> | 103 | /// <summary> |
100 | /// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class. | 104 | /// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class. |
@@ -106,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
106 | /// Gathered UUIDs will be collected in this dictionary. | 110 | /// Gathered UUIDs will be collected in this dictionary. |
107 | /// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected. | 111 | /// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected. |
108 | /// </param> | 112 | /// </param> |
109 | public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector, HashSet <UUID> failedIDs) | 113 | public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector, HashSet <UUID> failedIDs, HashSet <UUID> uncertainAssetsUUIDs) |
110 | { | 114 | { |
111 | m_assetService = assetService; | 115 | m_assetService = assetService; |
112 | GatheredUuids = collector; | 116 | GatheredUuids = collector; |
@@ -114,7 +118,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
114 | // FIXME: Not efficient for searching, can improve. | 118 | // FIXME: Not efficient for searching, can improve. |
115 | m_assetUuidsToInspect = new Queue<UUID>(); | 119 | m_assetUuidsToInspect = new Queue<UUID>(); |
116 | FailedUUIDs = failedIDs; | 120 | FailedUUIDs = failedIDs; |
121 | UncertainAssetsUUIDs = uncertainAssetsUUIDs; | ||
117 | ErrorCount = 0; | 122 | ErrorCount = 0; |
123 | possibleNotAssetCount = 0; | ||
118 | } | 124 | } |
119 | 125 | ||
120 | /// <summary> | 126 | /// <summary> |
@@ -124,8 +130,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
124 | /// <param name="uuid">UUID.</param> | 130 | /// <param name="uuid">UUID.</param> |
125 | public bool AddForInspection(UUID uuid) | 131 | public bool AddForInspection(UUID uuid) |
126 | { | 132 | { |
133 | if(uuid == UUID.Zero) | ||
134 | return false; | ||
135 | |||
127 | if(FailedUUIDs.Contains(uuid)) | 136 | if(FailedUUIDs.Contains(uuid)) |
128 | return false; | 137 | { |
138 | if(UncertainAssetsUUIDs.Contains(uuid)) | ||
139 | possibleNotAssetCount++; | ||
140 | else | ||
141 | ErrorCount++; | ||
142 | return false; | ||
143 | } | ||
129 | if(GatheredUuids.ContainsKey(uuid)) | 144 | if(GatheredUuids.ContainsKey(uuid)) |
130 | return false; | 145 | return false; |
131 | if (m_assetUuidsToInspect.Contains(uuid)) | 146 | if (m_assetUuidsToInspect.Contains(uuid)) |
@@ -283,9 +298,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
283 | /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param> | 298 | /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param> |
284 | private void GetAssetUuids(UUID assetUuid) | 299 | private void GetAssetUuids(UUID assetUuid) |
285 | { | 300 | { |
301 | if(assetUuid == UUID.Zero) | ||
302 | return; | ||
303 | |||
286 | if(FailedUUIDs.Contains(assetUuid)) | 304 | if(FailedUUIDs.Contains(assetUuid)) |
287 | { | 305 | { |
288 | ErrorCount++; | 306 | if(UncertainAssetsUUIDs.Contains(assetUuid)) |
307 | possibleNotAssetCount++; | ||
308 | else | ||
309 | ErrorCount++; | ||
289 | return; | 310 | return; |
290 | } | 311 | } |
291 | 312 | ||
@@ -309,11 +330,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
309 | if(assetBase == null) | 330 | if(assetBase == null) |
310 | { | 331 | { |
311 | // m_log.ErrorFormat("[UUID GATHERER]: asset {0} not found", assetUuid); | 332 | // m_log.ErrorFormat("[UUID GATHERER]: asset {0} not found", assetUuid); |
312 | ErrorCount++; | ||
313 | FailedUUIDs.Add(assetUuid); | 333 | FailedUUIDs.Add(assetUuid); |
334 | if(UncertainAssetsUUIDs.Contains(assetUuid)) | ||
335 | possibleNotAssetCount++; | ||
336 | else | ||
337 | ErrorCount++; | ||
314 | return; | 338 | return; |
315 | } | 339 | } |
316 | 340 | ||
341 | if(UncertainAssetsUUIDs.Contains(assetUuid)) | ||
342 | UncertainAssetsUUIDs.Remove(assetUuid); | ||
343 | |||
317 | sbyte assetType = assetBase.Type; | 344 | sbyte assetType = assetBase.Type; |
318 | 345 | ||
319 | if(assetBase.Data == null || assetBase.Data.Length == 0) | 346 | if(assetBase.Data == null || assetBase.Data.Length == 0) |
@@ -363,10 +390,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
363 | 390 | ||
364 | private void AddForInspection(UUID assetUuid, sbyte assetType) | 391 | private void AddForInspection(UUID assetUuid, sbyte assetType) |
365 | { | 392 | { |
393 | if(assetUuid == UUID.Zero) | ||
394 | return; | ||
395 | |||
366 | // Here, we want to collect uuids which require further asset fetches but mark the others as gathered | 396 | // Here, we want to collect uuids which require further asset fetches but mark the others as gathered |
367 | if(FailedUUIDs.Contains(assetUuid)) | 397 | if(FailedUUIDs.Contains(assetUuid)) |
368 | { | 398 | { |
369 | ErrorCount++; | 399 | if(UncertainAssetsUUIDs.Contains(assetUuid)) |
400 | possibleNotAssetCount++; | ||
401 | else | ||
402 | ErrorCount++; | ||
370 | return; | 403 | return; |
371 | } | 404 | } |
372 | if(GatheredUuids.ContainsKey(assetUuid)) | 405 | if(GatheredUuids.ContainsKey(assetUuid)) |
@@ -502,8 +535,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
502 | foreach (Match uuidMatch in uuidMatches) | 535 | foreach (Match uuidMatch in uuidMatches) |
503 | { | 536 | { |
504 | UUID uuid = new UUID(uuidMatch.Value); | 537 | UUID uuid = new UUID(uuidMatch.Value); |
538 | if(uuid == UUID.Zero) | ||
539 | continue; | ||
505 | // m_log.DebugFormat("[UUID GATHERER]: Recording {0} in text", uuid); | 540 | // m_log.DebugFormat("[UUID GATHERER]: Recording {0} in text", uuid); |
506 | 541 | if(!UncertainAssetsUUIDs.Contains(uuid)) | |
542 | UncertainAssetsUUIDs.Add(uuid); | ||
507 | AddForInspection(uuid); | 543 | AddForInspection(uuid); |
508 | } | 544 | } |
509 | } | 545 | } |