diff options
author | Justin Clark-Casey (justincc) | 2011-12-07 18:43:48 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-12-07 18:43:48 +0000 |
commit | 3d95015686cafd7e5510d649fc58328c9565768b (patch) | |
tree | 2baa3d9bf0384a0ff60209ddb237f659f684e24e | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-3d95015686cafd7e5510d649fc58328c9565768b.zip opensim-SC_OLD-3d95015686cafd7e5510d649fc58328c9565768b.tar.gz opensim-SC_OLD-3d95015686cafd7e5510d649fc58328c9565768b.tar.bz2 opensim-SC_OLD-3d95015686cafd7e5510d649fc58328c9565768b.tar.xz |
On an Exception in Scene.RemoveClient(), always remove the client (and SP) structure so that logout on unexpired packets isn't retriggered, causing the same exception
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 604f035..87af206 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3104,29 +3104,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
3104 | // Avatar is already disposed :/ | 3104 | // Avatar is already disposed :/ |
3105 | } | 3105 | } |
3106 | 3106 | ||
3107 | m_eventManager.TriggerOnRemovePresence(agentID); | 3107 | try |
3108 | 3108 | { | |
3109 | if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) | 3109 | m_eventManager.TriggerOnRemovePresence(agentID); |
3110 | AttachmentsModule.SaveChangedAttachments(avatar); | 3110 | |
3111 | 3111 | if (AttachmentsModule != null && !avatar.IsChildAgent && avatar.PresenceType != PresenceType.Npc) | |
3112 | ForEachClient( | 3112 | AttachmentsModule.SaveChangedAttachments(avatar); |
3113 | delegate(IClientAPI client) | 3113 | |
3114 | ForEachClient( | ||
3115 | delegate(IClientAPI client) | ||
3116 | { | ||
3117 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway | ||
3118 | try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } | ||
3119 | catch (NullReferenceException) { } | ||
3120 | }); | ||
3121 | |||
3122 | IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); | ||
3123 | if (agentTransactions != null) | ||
3114 | { | 3124 | { |
3115 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway | 3125 | agentTransactions.RemoveAgentAssetTransactions(agentID); |
3116 | try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } | 3126 | } |
3117 | catch (NullReferenceException) { } | 3127 | } |
3118 | }); | 3128 | finally |
3119 | |||
3120 | IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); | ||
3121 | if (agentTransactions != null) | ||
3122 | { | 3129 | { |
3123 | agentTransactions.RemoveAgentAssetTransactions(agentID); | 3130 | // Always clean these structures up so that any failure above doesn't cause them to remain in the |
3131 | // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering | ||
3132 | // the same cleanup exception continually. | ||
3133 | // TODO: This should probably extend to the whole method, but we don't want to also catch the NRE | ||
3134 | // since this would hide the underlying failure and other associated problems. | ||
3135 | m_sceneGraph.RemoveScenePresence(agentID); | ||
3136 | m_clientManager.Remove(agentID); | ||
3124 | } | 3137 | } |
3125 | 3138 | ||
3126 | // Remove the avatar from the scene | ||
3127 | m_sceneGraph.RemoveScenePresence(agentID); | ||
3128 | m_clientManager.Remove(agentID); | ||
3129 | |||
3130 | try | 3139 | try |
3131 | { | 3140 | { |
3132 | avatar.Close(); | 3141 | avatar.Close(); |