aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-12-04 23:55:59 +0000
committerJustin Clark-Casey (justincc)2014-12-04 23:55:59 +0000
commit9208fb5d543e5dd226d8d900c78a5056fea4f022 (patch)
tree6571fe8711c1b676c29f26eebd84c45c06b7b60a
parentAllow scripts in attachments on an owned NPC to call NPC functions on that NPC (diff)
downloadopensim-SC_OLD-9208fb5d543e5dd226d8d900c78a5056fea4f022.zip
opensim-SC_OLD-9208fb5d543e5dd226d8d900c78a5056fea4f022.tar.gz
opensim-SC_OLD-9208fb5d543e5dd226d8d900c78a5056fea4f022.tar.bz2
opensim-SC_OLD-9208fb5d543e5dd226d8d900c78a5056fea4f022.tar.xz
refactor: Make IteratingUUIDGatherer take a dictionary in its constructor like UUIDGatherer, so we can deal with future cases where the dictionary may already be pre-populated.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs32
2 files changed, 26 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 97267c1..fc932b0 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
604 // "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}", 604 // "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}",
605 // so.Name, so.AttachedAvatar, url); 605 // so.Name, so.AttachedAvatar, url);
606 606
607 IteratingHGUuidGatherer uuidGatherer = new IteratingHGUuidGatherer(Scene.AssetService, url); 607 IDictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
608 IteratingHGUuidGatherer uuidGatherer
609 = new IteratingHGUuidGatherer(Scene.AssetService, url, ids);
608 uuidGatherer.RecordAssetUuids(so); 610 uuidGatherer.RecordAssetUuids(so);
609 611
610 while (!uuidGatherer.Complete) 612 while (!uuidGatherer.Complete)
@@ -632,8 +634,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
632 } 634 }
633 } 635 }
634 636
635 IDictionary<UUID, sbyte> ids = uuidGatherer.GetGatheredUuids();
636
637 // m_log.DebugFormat( 637 // m_log.DebugFormat(
638 // "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}", 638 // "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}",
639 // ids.Count, so.Name, so.OwnerID, url); 639 // ids.Count, so.Name, so.OwnerID, url);
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 2450cdb..cacacf8 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -648,6 +648,15 @@ namespace OpenSim.Region.Framework.Scenes
648 } 648 }
649 } 649 }
650 650
651 /// <summary>
652 /// Gather uuids for a given entity.
653 /// </summary>
654 /// <remarks>
655 /// This does a deep inspection of the entity to retrieve all the assets it uses (whether as textures, as scripts
656 /// contained in inventory, as scripts contained in objects contained in another object's inventory, etc. Assets
657 /// are only retrieved when they are necessary to carry out the inspection (i.e. a serialized object needs to be
658 /// retrieved to work out which assets it references).
659 /// </remarks>
651 public class IteratingUuidGatherer 660 public class IteratingUuidGatherer
652 { 661 {
653 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 662 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -678,20 +687,25 @@ namespace OpenSim.Region.Framework.Scenes
678 687
679 protected Queue<UUID> m_assetUuidsToInspect; 688 protected Queue<UUID> m_assetUuidsToInspect;
680 689
681 public IteratingUuidGatherer(IAssetService assetService) 690 /// <summary>
691 /// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class.
692 /// </summary>
693 /// <param name="assetService">
694 /// Asset service.
695 /// </param>
696 /// <param name="collector">
697 /// Gathered UUIDs will be collected in this dictinaory.
698 /// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected.
699 /// </param>
700 public IteratingUuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector)
682 { 701 {
683 m_assetService = assetService; 702 m_assetService = assetService;
684 m_gatheredAssetUuids = new Dictionary<UUID, sbyte>(); 703 m_gatheredAssetUuids = collector;
685 704
686 // FIXME: Not efficient for searching, can improve. 705 // FIXME: Not efficient for searching, can improve.
687 m_assetUuidsToInspect = new Queue<UUID>(); 706 m_assetUuidsToInspect = new Queue<UUID>();
688 } 707 }
689 708
690 public IDictionary<UUID, sbyte> GetGatheredUuids()
691 {
692 return new Dictionary<UUID, sbyte>(m_gatheredAssetUuids);
693 }
694
695 public bool AddAssetUuidToInspect(UUID uuid) 709 public bool AddAssetUuidToInspect(UUID uuid)
696 { 710 {
697 if (m_assetUuidsToInspect.Contains(uuid)) 711 if (m_assetUuidsToInspect.Contains(uuid))
@@ -1147,8 +1161,8 @@ namespace OpenSim.Region.Framework.Scenes
1147 1161
1148 protected string m_assetServerURL; 1162 protected string m_assetServerURL;
1149 1163
1150 public IteratingHGUuidGatherer(IAssetService assetService, string assetServerURL) 1164 public IteratingHGUuidGatherer(IAssetService assetService, string assetServerURL, IDictionary<UUID, sbyte> collector)
1151 : base(assetService) 1165 : base(assetService, collector)
1152 { 1166 {
1153 m_assetServerURL = assetServerURL; 1167 m_assetServerURL = assetServerURL;
1154 if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("=")) 1168 if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("="))