diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 97267c1cd7..fc932b05f3 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -604,7 +604,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}", // so.Name, so.AttachedAvatar, url); - IteratingHGUuidGatherer uuidGatherer = new IteratingHGUuidGatherer(Scene.AssetService, url); + IDictionary ids = new Dictionary(); + IteratingHGUuidGatherer uuidGatherer + = new IteratingHGUuidGatherer(Scene.AssetService, url, ids); uuidGatherer.RecordAssetUuids(so); while (!uuidGatherer.Complete) @@ -632,8 +634,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } - IDictionary ids = uuidGatherer.GetGatheredUuids(); - // m_log.DebugFormat( // "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}", // ids.Count, so.Name, so.OwnerID, url); diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 2450cdbb84..cacacf8791 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -648,6 +648,15 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Gather uuids for a given entity. + /// + /// + /// This does a deep inspection of the entity to retrieve all the assets it uses (whether as textures, as scripts + /// contained in inventory, as scripts contained in objects contained in another object's inventory, etc. Assets + /// are only retrieved when they are necessary to carry out the inspection (i.e. a serialized object needs to be + /// retrieved to work out which assets it references). + /// public class IteratingUuidGatherer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -678,20 +687,25 @@ namespace OpenSim.Region.Framework.Scenes protected Queue m_assetUuidsToInspect; - public IteratingUuidGatherer(IAssetService assetService) + /// + /// Initializes a new instance of the class. + /// + /// + /// Asset service. + /// + /// + /// Gathered UUIDs will be collected in this dictinaory. + /// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected. + /// + public IteratingUuidGatherer(IAssetService assetService, IDictionary collector) { m_assetService = assetService; - m_gatheredAssetUuids = new Dictionary(); + m_gatheredAssetUuids = collector; // FIXME: Not efficient for searching, can improve. m_assetUuidsToInspect = new Queue(); } - public IDictionary GetGatheredUuids() - { - return new Dictionary(m_gatheredAssetUuids); - } - public bool AddAssetUuidToInspect(UUID uuid) { if (m_assetUuidsToInspect.Contains(uuid)) @@ -1147,8 +1161,8 @@ namespace OpenSim.Region.Framework.Scenes protected string m_assetServerURL; - public IteratingHGUuidGatherer(IAssetService assetService, string assetServerURL) - : base(assetService) + public IteratingHGUuidGatherer(IAssetService assetService, string assetServerURL, IDictionary collector) + : base(assetService, collector) { m_assetServerURL = assetServerURL; if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("="))