aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs61
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs31
3 files changed, 59 insertions, 39 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 171443e..f9ae39c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3241,37 +3241,38 @@ namespace OpenSim.Region.Framework.Scenes
3241 // Avatar is already disposed :/ 3241 // Avatar is already disposed :/
3242 } 3242 }
3243 3243
3244 m_log.Debug("[Scene] Beginning OnRemovePresence"); 3244 try
3245 m_eventManager.TriggerOnRemovePresence(agentID); 3245 {
3246 m_log.Debug("[Scene] Finished OnRemovePresence"); 3246 m_eventManager.TriggerOnRemovePresence(agentID);
3247 3247
3248 if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) 3248 if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc)
3249 AttachmentsModule.SaveChangedAttachments(avatar); 3249 AttachmentsModule.SaveChangedAttachments(avatar);
3250 3250
3251 if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) 3251 ForEachClient(
3252 AttachmentsModule.SaveChangedAttachments(avatar); 3252 delegate(IClientAPI client)
3253 3253 {
3254 ForEachClient( 3254 //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway
3255 delegate(IClientAPI client) 3255 try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); }
3256 catch (NullReferenceException) { }
3257 });
3258
3259 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
3260 if (agentTransactions != null)
3256 { 3261 {
3257 //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway 3262 agentTransactions.RemoveAgentAssetTransactions(agentID);
3258 try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } 3263 }
3259 catch (NullReferenceException) { } 3264 }
3260 }); 3265 finally
3261
3262 IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
3263 if (agentTransactions != null)
3264 { 3266 {
3265 agentTransactions.RemoveAgentAssetTransactions(agentID); 3267 // Always clean these structures up so that any failure above doesn't cause them to remain in the
3268 // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
3269 // the same cleanup exception continually.
3270 // TODO: This should probably extend to the whole method, but we don't want to also catch the NRE
3271 // since this would hide the underlying failure and other associated problems.
3272 m_sceneGraph.RemoveScenePresence(agentID);
3273 m_clientManager.Remove(agentID);
3266 } 3274 }
3267 3275
3268 // Remove the avatar from the scene
3269 m_log.Debug("[Scene] Begin RemoveScenePresence");
3270 m_sceneGraph.RemoveScenePresence(agentID);
3271 m_log.Debug("[Scene] Finished RemoveScenePresence. Removing the client manager");
3272 m_clientManager.Remove(agentID);
3273 m_log.Debug("[Scene] Removed the client manager. Firing avatar.close");
3274
3275 try 3276 try
3276 { 3277 {
3277 avatar.Close(); 3278 avatar.Close();
@@ -4390,7 +4391,7 @@ namespace OpenSim.Region.Framework.Scenes
4390 /// <param name="action"></param> 4391 /// <param name="action"></param>
4391 public void ForEachRootScenePresence(Action<ScenePresence> action) 4392 public void ForEachRootScenePresence(Action<ScenePresence> action)
4392 { 4393 {
4393 if(m_sceneGraph != null) 4394 if (m_sceneGraph != null)
4394 { 4395 {
4395 m_sceneGraph.ForEachAvatar(action); 4396 m_sceneGraph.ForEachAvatar(action);
4396 } 4397 }
@@ -4470,9 +4471,9 @@ namespace OpenSim.Region.Framework.Scenes
4470 return m_sceneGraph.GetGroupByPrim(localID); 4471 return m_sceneGraph.GetGroupByPrim(localID);
4471 } 4472 }
4472 4473
4473 public override bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) 4474 public override bool TryGetScenePresence(UUID agentID, out ScenePresence sp)
4474 { 4475 {
4475 return m_sceneGraph.TryGetScenePresence(avatarId, out avatar); 4476 return m_sceneGraph.TryGetScenePresence(agentID, out sp);
4476 } 4477 }
4477 4478
4478 public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) 4479 public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 0fd5164..29ab071 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -193,6 +193,12 @@ namespace OpenSim.Region.Framework.Scenes
193 return false; 193 return false;
194 } 194 }
195 195
196 /// <summary>
197 /// Try to get a scene presence from the scene
198 /// </summary>
199 /// <param name="agentID"></param>
200 /// <param name="scenePresence">null if there is no scene presence with the given agent id</param>
201 /// <returns>true if there was a scene presence with the given id, false otherwise.</returns>
196 public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence); 202 public abstract bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence);
197 203
198 #endregion 204 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 82458e2..d73a959 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -545,23 +545,20 @@ namespace OpenSim.Region.Framework.Scenes
545 return false; 545 return false;
546 } 546 }
547 547
548 public bool TryGetAvatarsScene(UUID avatarId, out Scene scene) 548 public bool TryGetRootScenePresence(UUID avatarId, out ScenePresence avatar)
549 { 549 {
550 ScenePresence avatar = null;
551
552 lock (m_localScenes) 550 lock (m_localScenes)
553 { 551 {
554 foreach (Scene mScene in m_localScenes) 552 foreach (Scene scene in m_localScenes)
555 { 553 {
556 if (mScene.TryGetScenePresence(avatarId, out avatar)) 554 avatar = scene.GetScenePresence(avatarId);
557 { 555
558 scene = mScene; 556 if (avatar != null && !avatar.IsChildAgent)
559 return true; 557 return true;
560 }
561 } 558 }
562 } 559 }
563 560
564 scene = null; 561 avatar = null;
565 return false; 562 return false;
566 } 563 }
567 564
@@ -590,6 +587,22 @@ namespace OpenSim.Region.Framework.Scenes
590 return false; 587 return false;
591 } 588 }
592 589
590 public bool TryGetRootScenePresenceByName(string firstName, string lastName, out ScenePresence sp)
591 {
592 lock (m_localScenes)
593 {
594 foreach (Scene scene in m_localScenes)
595 {
596 sp = scene.GetScenePresence(firstName, lastName);
597 if (sp != null && !sp.IsChildAgent)
598 return true;
599 }
600 }
601
602 sp = null;
603 return false;
604 }
605
593 public void ForEachScene(Action<Scene> action) 606 public void ForEachScene(Action<Scene> action)
594 { 607 {
595 lock (m_localScenes) 608 lock (m_localScenes)