From 5ce5ce6edb2217639cdcc375bf375452b81bb868 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 2 Sep 2013 17:45:38 +0100
Subject: Comment out warning about agent updating without valid session ID for
now.
This causes extreme console spam if a simulator running latest master and one running 0.7.5 have adjacent regions occupied by avatars.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d547323..005c9b9 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4346,10 +4346,10 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)
{
- if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID)
- // Only warn for now
- m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}. Neighbor running older version?",
- childAgentUpdate.UUID, cAgentData.SessionID);
+// if (childAgentUpdate.ControllingClient.SessionId != cAgentData.SessionID)
+// // Only warn for now
+// m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}. Neighbor running older version?",
+// childAgentUpdate.UUID, cAgentData.SessionID);
// I can't imagine *yet* why we would get an update if the agent is a root agent..
// however to avoid a race condition crossing borders..
--
cgit v1.1
From 857f24a5e2b59072ad4d987d5e64318f5249c7e7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 2 Sep 2013 19:15:10 +0100
Subject: Fix bug where users teleporting to non-neighbour regions could
continue to hear chat from their source region for some time after teleport
completion.
This occurs on v2 teleport since the source region now waits 15 secs before closing the old child agent, which could still receive chat.
This commit introduces a ScenePresenceState.PreClose which is set before the wait, so that ChatModule can check for ScenePresenceState.Running.
This was theoretically also an issue on v1 teleport but since the pause before close was only 2 secs there, it was not noticed.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 59 ++++++++++++++++++++--
.../Framework/Scenes/ScenePresenceStateMachine.cs | 15 +++++-
2 files changed, 67 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 005c9b9..2a21a4c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3695,10 +3695,13 @@ namespace OpenSim.Region.Framework.Scenes
// We need to ensure that we are not already removing the scene presence before we ask it not to be
// closed.
- if (sp != null && sp.IsChildAgent && sp.LifecycleState == ScenePresenceState.Running)
+ if (sp != null && sp.IsChildAgent
+ && (sp.LifecycleState == ScenePresenceState.Running
+ || sp.LifecycleState == ScenePresenceState.PreRemove))
{
m_log.DebugFormat(
- "[SCENE]: Reusing existing child scene presence for {0} in {1}", sp.Name, Name);
+ "[SCENE]: Reusing existing child scene presence for {0}, state {1} in {2}",
+ sp.Name, sp.LifecycleState, Name);
// In the case where, for example, an A B C D region layout, an avatar may
// teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C
@@ -3720,6 +3723,8 @@ namespace OpenSim.Region.Framework.Scenes
// }
// else if (EntityTransferModule.IsInTransit(sp.UUID))
+ sp.LifecycleState = ScenePresenceState.Running;
+
if (EntityTransferModule.IsInTransit(sp.UUID))
{
sp.DoNotCloseAfterTeleport = true;
@@ -4441,6 +4446,50 @@ namespace OpenSim.Region.Framework.Scenes
}
///
+ /// Tell a single agent to prepare to close.
+ ///
+ ///
+ /// This should only be called if we may close the agent but there will be some delay in so doing. Meant for
+ /// internal use - other callers should almost certainly called IncomingCloseAgent().
+ ///
+ ///
+ /// true if pre-close state notification was successful. false if the agent
+ /// was not in a state where it could transition to pre-close.
+ public bool IncomingPreCloseAgent(ScenePresence sp)
+ {
+ lock (m_removeClientLock)
+ {
+ // We need to avoid a race condition where in, for example, an A B C D region layout, an avatar may
+ // teleport from A -> D, but then -> C before A has asked B to close its old child agent. We do not
+ // want to obey this close since C may have renewed the child agent lease on B.
+ if (sp.DoNotCloseAfterTeleport)
+ {
+ m_log.DebugFormat(
+ "[SCENE]: Not pre-closing {0} agent {1} in {2} since another simulator has re-established the child connection",
+ sp.IsChildAgent ? "child" : "root", sp.Name, Name);
+
+ // Need to reset the flag so that a subsequent close after another teleport can succeed.
+ sp.DoNotCloseAfterTeleport = false;
+
+ return false;
+ }
+
+ if (sp.LifecycleState != ScenePresenceState.Running)
+ {
+ m_log.DebugFormat(
+ "[SCENE]: Called IncomingPreCloseAgent() for {0} in {1} but presence is already in state {2}",
+ sp.Name, Name, sp.LifecycleState);
+
+ return false;
+ }
+
+ sp.LifecycleState = ScenePresenceState.PreRemove;
+
+ return true;
+ }
+ }
+
+ ///
/// Tell a single agent to disconnect from the region.
///
///
@@ -4459,16 +4508,16 @@ namespace OpenSim.Region.Framework.Scenes
if (sp == null)
{
m_log.DebugFormat(
- "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in {1}",
+ "[SCENE]: Called IncomingCloseAgent() with agent ID {0} but no such presence is in {1}",
agentID, Name);
return false;
}
- if (sp.LifecycleState != ScenePresenceState.Running)
+ if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove)
{
m_log.DebugFormat(
- "[SCENE]: Called RemoveClient() for {0} in {1} but presence is already in state {2}",
+ "[SCENE]: Called IncomingCloseAgent() for {0} in {1} but presence is already in state {2}",
sp.Name, Name, sp.LifecycleState);
return false;
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
/// This is a state machine.
///
/// [Entry] => Running
- /// Running => Removing
+ /// Running => PreRemove, Removing
+ /// PreRemove => Running, Removing
/// Removing => Removed
///
/// 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
public enum ScenePresenceState
{
Running, // Normal operation state. The scene presence is available.
+ PreRemove, // The presence is due to be removed but can still be returning to running.
Removing, // The presence is in the process of being removed from the scene via Scene.RemoveClient.
Removed, // The presence has been removed from the scene and is effectively dead.
// There is no exit from this state.
@@ -80,8 +82,17 @@ namespace OpenSim.Region.Framework.Scenes
lock (this)
{
- if (newState == ScenePresenceState.Removing && m_state == ScenePresenceState.Running)
+ if (newState == m_state)
+ return;
+ else if (newState == ScenePresenceState.Running && m_state == ScenePresenceState.PreRemove)
transitionOkay = true;
+ else if (newState == ScenePresenceState.PreRemove && m_state == ScenePresenceState.Running)
+ transitionOkay = true;
+ else if (newState == ScenePresenceState.Removing)
+ {
+ if (m_state == ScenePresenceState.Running || m_state == ScenePresenceState.PreRemove)
+ transitionOkay = true;
+ }
else if (newState == ScenePresenceState.Removed && m_state == ScenePresenceState.Removing)
transitionOkay = true;
}
--
cgit v1.1
From 5f0d54c209249e0640bc27b3d74a92e7c9d82428 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 26 Aug 2013 20:04:07 +0100
Subject: For a Hypergrid user, delay estate access checks until
NewUserConnection() so that they work.
This is necessary because the hypergrid groups checks (as referenced by estates) require an agent circuit to be present to construct the hypergrid ID.
However, this is not around until Scene.NewUserConnection(), as called by CreateAgent() in EntityTransferModule.
Therefore, if we're dealing with a hypergrid user, delay the check until NewUserConnection()/CreateAgent()
The entity transfer impact should be minimal since CreateAgent() is the next significant call after NewUserConnection()
However, to preserve the accuracy of query access we will only relax the check for HG users.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2a21a4c..8754024 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5788,9 +5788,13 @@ namespace OpenSim.Region.Framework.Scenes
try
{
- if (!AuthorizeUser(aCircuit, false, out reason))
+ // If this is a hypergrid user, then we can't perform a successful groups access check here since this
+ // currently relies on a circuit being present in the AuthenticateHandler to construct a Hypergrid ID.
+ // This is only present in NewUserConnection() which entity transfer calls very soon after QueryAccess().
+ // Therefore, we'll defer to the check in NewUserConnection() instead.
+ if (!AuthorizeUser(aCircuit, !UserManagementModule.IsLocalGridUser(agentID), out reason))
{
- // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
+ //m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
return false;
}
}
--
cgit v1.1
From c7ded0618c303f8c24a91c83c2129292beebe466 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 27 Aug 2013 00:35:33 +0100
Subject: Also check user authorization if looking to upgrade from a child to a
root agent.
Relevant if a child agent has been allowed into the region which should not be upgraded to a root agent.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 13 +++++++++++++
1 file changed, 13 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 8754024..3eaa8fd 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3860,6 +3860,19 @@ namespace OpenSim.Region.Framework.Scenes
// Let the SP know how we got here. This has a lot of interesting
// uses down the line.
sp.TeleportFlags = (TPFlags)teleportFlags;
+
+ // We must carry out a further authorization check if there's an
+ // attempt to make a child agent into a root agent, since SeeIntoRegion may have allowed a child
+ // agent to login to a region where a full avatar would not be allowed.
+ //
+ // We determine whether this is a CreateAgent for a future non-child agent by inspecting
+ // TeleportFlags, which will be default for a child connection. This relies on input from the source
+ // region.
+ if (sp.TeleportFlags != TPFlags.Default)
+ {
+ if (!AuthorizeUser(acd, false, out reason))
+ return false;
+ }
if (sp.IsChildAgent)
{
--
cgit v1.1
From 04619a9b139ac67c92b5b8be9607544be2621d7e Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Thu, 5 Sep 2013 07:44:27 -0700
Subject: Restore group membership check for HG users in QueryAccess.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3eaa8fd..e00206f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5801,11 +5801,7 @@ namespace OpenSim.Region.Framework.Scenes
try
{
- // If this is a hypergrid user, then we can't perform a successful groups access check here since this
- // currently relies on a circuit being present in the AuthenticateHandler to construct a Hypergrid ID.
- // This is only present in NewUserConnection() which entity transfer calls very soon after QueryAccess().
- // Therefore, we'll defer to the check in NewUserConnection() instead.
- if (!AuthorizeUser(aCircuit, !UserManagementModule.IsLocalGridUser(agentID), out reason))
+ if (!AuthorizeUser(aCircuit, false, out reason))
{
//m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID);
return false;
--
cgit v1.1