aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-11-04 16:49:32 +0000
committerJustin Clark-Casey (justincc)2014-11-25 23:23:10 +0000
commit1d19e1bbd0dfc1e7de99652284963d330f04de99 (patch)
tree5b5f00b05389751d883bb24f3e64467d21de5548 /OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
parentLabel all threadpool calls being made in core OpenSimulator. This is to add ... (diff)
downloadopensim-SC_OLD-1d19e1bbd0dfc1e7de99652284963d330f04de99.zip
opensim-SC_OLD-1d19e1bbd0dfc1e7de99652284963d330f04de99.tar.gz
opensim-SC_OLD-1d19e1bbd0dfc1e7de99652284963d330f04de99.tar.bz2
opensim-SC_OLD-1d19e1bbd0dfc1e7de99652284963d330f04de99.tar.xz
Add naive implementation of controlled incoming HG attachments to manage load.
Instead of processing all incoming attachment scene object concurrently, process them consecutively to eliminate potential overload from this source. This is a naive implementation because it does not currently account for slow foreign asset services. Although it may take longer, this approach may also improve attachment visibility for HG avatars since the scene object is now always added to the scene after receiving assets from the foreign service and not before.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs80
1 files changed, 53 insertions, 27 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 72d6bac..519c18b 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -153,33 +153,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
153 if (m_Enabled) 153 if (m_Enabled)
154 { 154 {
155 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); 155 scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
156 scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; 156 //scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
157 }
158 }
159
160 void OnIncomingSceneObject(SceneObjectGroup so)
161 {
162 if (!so.IsAttachment)
163 return;
164 157
165 if (so.AttachedAvatar == UUID.Zero || Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar)) 158 m_incomingSceneObjectEngine.Start();
166 return;
167
168 // foreign user
169 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar);
170 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
171 {
172 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServRezerURI"))
173 {
174 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
175 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url);
176 Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
177 HGUuidGatherer uuidGatherer = new HGUuidGatherer(Scene.AssetService, url);
178 uuidGatherer.GatherAssetUuids(so, ids);
179
180 foreach (KeyValuePair<UUID, sbyte> kvp in ids)
181 uuidGatherer.FetchAsset(kvp.Key);
182 }
183 } 159 }
184 } 160 }
185 161
@@ -209,12 +185,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
209 base.RemoveRegion(scene); 185 base.RemoveRegion(scene);
210 186
211 if (m_Enabled) 187 if (m_Enabled)
188 {
212 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); 189 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);
190 m_incomingSceneObjectEngine.Stop();
191 }
213 } 192 }
214 193
215 #endregion 194 #endregion
216 195
217 #region HG overrides of IEntiryTransferModule 196 #region HG overrides of IEntityTransferModule
218 197
219 protected override GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message) 198 protected override GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message)
220 { 199 {
@@ -561,6 +540,53 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
561 } 540 }
562 } 541 }
563 542
543 private HGIncomingSceneObjectEngine m_incomingSceneObjectEngine = new HGIncomingSceneObjectEngine();
544
545 public override bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition)
546 {
547 // FIXME: We must make it so that we can use SOG.IsAttachment here. At the moment it is always null!
548 if (!so.IsAttachmentCheckFull())
549 return base.HandleIncomingSceneObject(so, newPosition);
550
551 // Equally, we can't use so.AttachedAvatar here.
552 if (so.OwnerID == UUID.Zero || Scene.UserManagementModule.IsLocalGridUser(so.OwnerID))
553 return base.HandleIncomingSceneObject(so, newPosition);
554
555 // foreign user
556 AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.OwnerID);
557 if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
558 {
559 if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
560 {
561 m_incomingSceneObjectEngine.QueueRequest(
562 string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name),
563 o =>
564 {
565 string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
566 m_log.DebugFormat(
567 "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset server {2}",
568 so.Name, so.AttachedAvatar, url);
569
570 Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
571 HGUuidGatherer uuidGatherer = new HGUuidGatherer(Scene.AssetService, url);
572 uuidGatherer.GatherAssetUuids(so, ids);
573
574 foreach (KeyValuePair<UUID, sbyte> kvp in ids)
575 uuidGatherer.FetchAsset(kvp.Key);
576
577 base.HandleIncomingSceneObject(so, newPosition);
578
579 m_log.DebugFormat(
580 "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}",
581 so.Name, so.OwnerID, url);
582 },
583 null);
584 }
585 }
586
587 return true;
588 }
589
564 #endregion 590 #endregion
565 591
566 #region IUserAgentVerificationModule 592 #region IUserAgentVerificationModule