aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2013-09-07 13:54:19 +0100
committerMelanie2013-09-07 13:54:19 +0100
commit2f365ea80be0df545a74da03afceb964da1546d1 (patch)
treea54202b1cdabaa201c0566232bde69cecdcfef6a /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' into careminster (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-2f365ea80be0df545a74da03afceb964da1546d1.zip
opensim-SC_OLD-2f365ea80be0df545a74da03afceb964da1546d1.tar.gz
opensim-SC_OLD-2f365ea80be0df545a74da03afceb964da1546d1.tar.bz2
opensim-SC_OLD-2f365ea80be0df545a74da03afceb964da1546d1.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs82
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresenceStateMachine.cs15
2 files changed, 85 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f864392..18e7eb8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3854,10 +3854,13 @@ namespace OpenSim.Region.Framework.Scenes
3854 3854
3855 // We need to ensure that we are not already removing the scene presence before we ask it not to be 3855 // We need to ensure that we are not already removing the scene presence before we ask it not to be
3856 // closed. 3856 // closed.
3857 if (sp != null && sp.IsChildAgent && sp.LifecycleState == ScenePresenceState.Running) 3857 if (sp != null && sp.IsChildAgent
3858 && (sp.LifecycleState == ScenePresenceState.Running
3859 || sp.LifecycleState == ScenePresenceState.PreRemove))
3858 { 3860 {
3859 m_log.DebugFormat( 3861 m_log.DebugFormat(
3860 "[SCENE]: Reusing existing child scene presence for {0} in {1}", sp.Name, Name); 3862 "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}",
3863 sp.Name, sp.LifecycleState, Name);
3861 3864
3862 // In the case where, for example, an A B C D region layout, an avatar may 3865 // In the case where, for example, an A B C D region layout, an avatar may
3863 // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C 3866 // teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C
@@ -3879,6 +3882,8 @@ namespace OpenSim.Region.Framework.Scenes
3879// } 3882// }
3880// else if (EntityTransferModule.IsInTransit(sp.UUID)) 3883// else if (EntityTransferModule.IsInTransit(sp.UUID))
3881 3884
3885 sp.LifecycleState = ScenePresenceState.Running;
3886
3882 if (EntityTransferModule.IsInTransit(sp.UUID)) 3887 if (EntityTransferModule.IsInTransit(sp.UUID))
3883 { 3888 {
3884 sp.DoNotCloseAfterTeleport = true; 3889 sp.DoNotCloseAfterTeleport = true;
@@ -4018,6 +4023,19 @@ namespace OpenSim.Region.Framework.Scenes
4018 // uses down the line. 4023 // uses down the line.
4019 sp.TeleportFlags = (TPFlags)teleportFlags; 4024 sp.TeleportFlags = (TPFlags)teleportFlags;
4020 4025
4026 // We must carry out a further authorization check if there's an
4027 // attempt to make a child agent into a root agent, since SeeIntoRegion may have allowed a child
4028 // agent to login to a region where a full avatar would not be allowed.
4029 //
4030 // We determine whether this is a CreateAgent for a future non-child agent by inspecting
4031 // TeleportFlags, which will be default for a child connection. This relies on input from the source
4032 // region.
4033 if (sp.TeleportFlags != TPFlags.Default)
4034 {
4035 if (!AuthorizeUser(acd, false, out reason))
4036 return false;
4037 }
4038
4021 if (sp.IsChildAgent) 4039 if (sp.IsChildAgent)
4022 { 4040 {
4023 m_log.DebugFormat( 4041 m_log.DebugFormat(
@@ -4526,10 +4544,10 @@ namespace OpenSim.Region.Framework.Scenes
4526 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 4544 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
4527 if (childAgentUpdate != null) 4545 if (childAgentUpdate != null)
4528 { 4546 {
4529 if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID) 4547// if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID)
4530 // Only warn for now 4548// // Only warn for now
4531 m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}. Neighbor running older version?", 4549// m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}. Neighbor running older version?",
4532 childAgentUpdate.UUID, cAgentData.SessionID); 4550// childAgentUpdate.UUID, cAgentData.SessionID);
4533 4551
4534 // I can't imagine *yet* why we would get an update if the agent is a root agent.. 4552 // I can't imagine *yet* why we would get an update if the agent is a root agent..
4535 // however to avoid a race condition crossing borders.. 4553 // however to avoid a race condition crossing borders..
@@ -4631,6 +4649,50 @@ namespace OpenSim.Region.Framework.Scenes
4631 } 4649 }
4632 4650
4633 /// <summary> 4651 /// <summary>
4652 /// Tell a single agent to prepare to close.
4653 /// </summary>
4654 /// <remarks>
4655 /// This should only be called if we may close the agent but there will be some delay in so doing. Meant for
4656 /// internal use - other callers should almost certainly called IncomingCloseAgent().
4657 /// </remarks>
4658 /// <param name="sp"></param>
4659 /// <returns>true if pre-close state notification was successful. false if the agent
4660 /// was not in a state where it could transition to pre-close.</returns>
4661 public bool IncomingPreCloseAgent(ScenePresence sp)
4662 {
4663 lock (m_removeClientLock)
4664 {
4665 // We need to avoid a race condition where in, for example, an A B C D region layout, an avatar may
4666 // teleport from A -> D, but then -> C before A has asked B to close its old child agent. We do not
4667 // want to obey this close since C may have renewed the child agent lease on B.
4668 if (sp.DoNotCloseAfterTeleport)
4669 {
4670 m_log.DebugFormat(
4671 "[SCENE]: Not pre-closing {0} agent {1} in {2} since another simulator has re-established the child connection",
4672 sp.IsChildAgent ? "child" : "root", sp.Name, Name);
4673
4674 // Need to reset the flag so that a subsequent close after another teleport can succeed.
4675 sp.DoNotCloseAfterTeleport = false;
4676
4677 return false;
4678 }
4679
4680 if (sp.LifecycleState != ScenePresenceState.Running)
4681 {
4682 m_log.DebugFormat(
4683 "[SCENE]: Called IncomingPreCloseAgent() for {0} in {1} but presence is already in state {2}",
4684 sp.Name, Name, sp.LifecycleState);
4685
4686 return false;
4687 }
4688
4689 sp.LifecycleState = ScenePresenceState.PreRemove;
4690
4691 return true;
4692 }
4693 }
4694
4695 /// <summary>
4634 /// Tell a single agent to disconnect from the region. 4696 /// Tell a single agent to disconnect from the region.
4635 /// </summary> 4697 /// </summary>
4636 /// <param name="agentID"></param> 4698 /// <param name="agentID"></param>
@@ -4649,16 +4711,16 @@ namespace OpenSim.Region.Framework.Scenes
4649 if (sp == null) 4711 if (sp == null)
4650 { 4712 {
4651 m_log.DebugFormat( 4713 m_log.DebugFormat(
4652 "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in {1}", 4714 "[SCENE]: Called IncomingCloseAgent() with agent ID {0} but no such presence is in {1}",
4653 agentID, Name); 4715 agentID, Name);
4654 4716
4655 return false; 4717 return false;
4656 } 4718 }
4657 4719
4658 if (sp.LifecycleState != ScenePresenceState.Running) 4720 if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove)
4659 { 4721 {
4660 m_log.DebugFormat( 4722 m_log.DebugFormat(
4661 "[SCENE]: Called RemoveClient() for {0} in {1} but presence is already in state {2}", 4723 "[SCENE]: Called IncomingCloseAgent() for {0} in {1} but presence is already in state {2}",
4662 sp.Name, Name, sp.LifecycleState); 4724 sp.Name, Name, sp.LifecycleState);
4663 4725
4664 return false; 4726 return false;
@@ -6025,7 +6087,7 @@ Environment.Exit(1);
6025 { 6087 {
6026 if (!AuthorizeUser(aCircuit, false, out reason)) 6088 if (!AuthorizeUser(aCircuit, false, out reason))
6027 { 6089 {
6028 // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); 6090 //m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
6029 return false; 6091 return false;
6030 } 6092 }
6031 } 6093 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresenceStateMachine.cs b/OpenSim/Region/Framework/Scenes/ScenePresenceStateMachine.cs
index dc3a212..cae7fe5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresenceStateMachine.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresenceStateMachine.cs
@@ -37,7 +37,8 @@ namespace OpenSim.Region.Framework.Scenes
37 /// This is a state machine. 37 /// This is a state machine.
38 /// 38 ///
39 /// [Entry] => Running 39 /// [Entry] => Running
40 /// Running => Removing 40 /// Running => PreRemove, Removing
41 /// PreRemove => Running, Removing
41 /// Removing => Removed 42 /// Removing => Removed
42 /// 43 ///
43 /// All other methods should only see the scene presence in running state - this is the normal operational state 44 /// All other methods should only see the scene presence in running state - this is the normal operational state
@@ -46,6 +47,7 @@ namespace OpenSim.Region.Framework.Scenes
46 public enum ScenePresenceState 47 public enum ScenePresenceState
47 { 48 {
48 Running, // Normal operation state. The scene presence is available. 49 Running, // Normal operation state. The scene presence is available.
50 PreRemove, // The presence is due to be removed but can still be returning to running.
49 Removing, // The presence is in the process of being removed from the scene via Scene.RemoveClient. 51 Removing, // The presence is in the process of being removed from the scene via Scene.RemoveClient.
50 Removed, // The presence has been removed from the scene and is effectively dead. 52 Removed, // The presence has been removed from the scene and is effectively dead.
51 // There is no exit from this state. 53 // There is no exit from this state.
@@ -80,8 +82,17 @@ namespace OpenSim.Region.Framework.Scenes
80 82
81 lock (this) 83 lock (this)
82 { 84 {
83 if (newState == ScenePresenceState.Removing && m_state == ScenePresenceState.Running) 85 if (newState == m_state)
86 return;
87 else if (newState == ScenePresenceState.Running && m_state == ScenePresenceState.PreRemove)
84 transitionOkay = true; 88 transitionOkay = true;
89 else if (newState == ScenePresenceState.PreRemove && m_state == ScenePresenceState.Running)
90 transitionOkay = true;
91 else if (newState == ScenePresenceState.Removing)
92 {
93 if (m_state == ScenePresenceState.Running || m_state == ScenePresenceState.PreRemove)
94 transitionOkay = true;
95 }
85 else if (newState == ScenePresenceState.Removed && m_state == ScenePresenceState.Removing) 96 else if (newState == ScenePresenceState.Removed && m_state == ScenePresenceState.Removing)
86 transitionOkay = true; 97 transitionOkay = true;
87 } 98 }