diff options
author | Justin Clark-Casey (justincc) | 2014-10-22 23:46:05 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-11-25 23:22:20 +0000 |
commit | b7ef6009a7a57be6457b61220333d08a8976d9d1 (patch) | |
tree | 8a55c97dfabefc7f1b130025f96bff7582f532a3 /OpenSim/Region/Framework | |
parent | For now, send all non-full terse updates for ones own avatar directly to the ... (diff) | |
download | opensim-SC-b7ef6009a7a57be6457b61220333d08a8976d9d1.zip opensim-SC-b7ef6009a7a57be6457b61220333d08a8976d9d1.tar.gz opensim-SC-b7ef6009a7a57be6457b61220333d08a8976d9d1.tar.bz2 opensim-SC-b7ef6009a7a57be6457b61220333d08a8976d9d1.tar.xz |
In Scene.AddNewAgent(), avoid a situation where an exception can result in a client being added to the manager without IClientAPI.SceneAgent being set.
This is done by adjusting the order of code so that SceneAgent will always be set before adding the client.
Various parts of the code (rightly) assume that a a client registered to the manager will always have a SceneAgent set no matter what.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9c4aea0..f792920 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2789,29 +2789,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
2789 | m_log.DebugFormat( | 2789 | m_log.DebugFormat( |
2790 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", | 2790 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", |
2791 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | 2791 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); |
2792 | 2792 | ||
2793 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | ||
2794 | |||
2795 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | ||
2796 | // client is for a root or child agent. | ||
2797 | // We must also set this before adding the client to the client manager so that an exception later on | ||
2798 | // does not leave a client manager entry without the scene agent set, which will cause other code | ||
2799 | // to fail since any entry in the client manager should have a ScenePresence | ||
2800 | // | ||
2801 | // XXX: This may be better set for a new client before that client is added to the client manager. | ||
2802 | // But need to know what happens in the case where a ScenePresence is already present (and if this | ||
2803 | // actually occurs). | ||
2804 | client.SceneAgent = sp; | ||
2805 | |||
2793 | m_clientManager.Add(client); | 2806 | m_clientManager.Add(client); |
2794 | SubscribeToClientEvents(client); | 2807 | SubscribeToClientEvents(client); |
2795 | |||
2796 | sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); | ||
2797 | m_eventManager.TriggerOnNewPresence(sp); | 2808 | m_eventManager.TriggerOnNewPresence(sp); |
2798 | 2809 | ||
2799 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; | 2810 | sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; |
2800 | } | 2811 | } |
2801 | else | 2812 | else |
2802 | { | 2813 | { |
2814 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | ||
2815 | // client is for a root or child agent. | ||
2816 | // XXX: This may be better set for a new client before that client is added to the client manager. | ||
2817 | // But need to know what happens in the case where a ScenePresence is already present (and if this | ||
2818 | // actually occurs). | ||
2819 | client.SceneAgent = sp; | ||
2820 | |||
2803 | m_log.WarnFormat( | 2821 | m_log.WarnFormat( |
2804 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", | 2822 | "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", |
2805 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); | 2823 | sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName); |
2824 | |||
2806 | reallyNew = false; | 2825 | reallyNew = false; |
2807 | } | 2826 | } |
2808 | |||
2809 | // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the | ||
2810 | // client is for a root or child agent. | ||
2811 | // XXX: This may be better set for a new client before that client is added to the client manager. | ||
2812 | // But need to know what happens in the case where a ScenePresence is already present (and if this | ||
2813 | // actually occurs). | ||
2814 | client.SceneAgent = sp; | ||
2815 | 2827 | ||
2816 | // This is currently also being done earlier in NewUserConnection for real users to see if this | 2828 | // This is currently also being done earlier in NewUserConnection for real users to see if this |
2817 | // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other | 2829 | // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other |