aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs93
1 files changed, 45 insertions, 48 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d6d2df4..21036d8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -751,6 +751,7 @@ namespace OpenSim.Region.Framework.Scenes
751 m_config = config; 751 m_config = config;
752 MinFrameTime = 0.089f; 752 MinFrameTime = 0.089f;
753 MinMaintenanceTime = 1; 753 MinMaintenanceTime = 1;
754 SeeIntoRegion = true;
754 755
755 Random random = new Random(); 756 Random random = new Random();
756 757
@@ -863,6 +864,7 @@ namespace OpenSim.Region.Framework.Scenes
863 //Animation states 864 //Animation states
864 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 865 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
865 866
867 SeeIntoRegion = startupConfig.GetBoolean("see_into_region", SeeIntoRegion);
866 868
867 MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); 869 MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20);
868 870
@@ -1338,7 +1340,7 @@ namespace OpenSim.Region.Framework.Scenes
1338 Thread.Sleep(500); 1340 Thread.Sleep(500);
1339 1341
1340 // Stop all client threads. 1342 // Stop all client threads.
1341 ForEachScenePresence(delegate(ScenePresence avatar) { IncomingCloseAgent(avatar.UUID, false); }); 1343 ForEachScenePresence(delegate(ScenePresence avatar) { CloseAgent(avatar.UUID, false); });
1342 1344
1343 m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); 1345 m_log.Debug("[SCENE]: TriggerSceneShuttingDown");
1344 EventManager.TriggerSceneShuttingDown(this); 1346 EventManager.TriggerSceneShuttingDown(this);
@@ -2953,7 +2955,7 @@ namespace OpenSim.Region.Framework.Scenes
2953 2955
2954 #region Add/Remove Avatar Methods 2956 #region Add/Remove Avatar Methods
2955 2957
2956 public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type) 2958 public override ISceneAgent AddNewAgent(IClientAPI client, PresenceType type)
2957 { 2959 {
2958 ScenePresence sp; 2960 ScenePresence sp;
2959 bool vialogin; 2961 bool vialogin;
@@ -2961,7 +2963,7 @@ namespace OpenSim.Region.Framework.Scenes
2961 2963
2962 // Validation occurs in LLUDPServer 2964 // Validation occurs in LLUDPServer
2963 // 2965 //
2964 // XXX: A race condition exists here where two simultaneous calls to AddNewClient can interfere with 2966 // XXX: A race condition exists here where two simultaneous calls to AddNewAgent can interfere with
2965 // each other. In practice, this does not currently occur in the code. 2967 // each other. In practice, this does not currently occur in the code.
2966 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2968 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2967 2969
@@ -2969,9 +2971,9 @@ namespace OpenSim.Region.Framework.Scenes
2969 // and a simultaneous one that removes it (as can happen if the client is closed at a particular point 2971 // and a simultaneous one that removes it (as can happen if the client is closed at a particular point
2970 // whilst connecting). 2972 // whilst connecting).
2971 // 2973 //
2972 // It would be easier to lock across all NewUserConnection(), AddNewClient() and 2974 // It would be easier to lock across all NewUserConnection(), AddNewAgent() and
2973 // RemoveClient() calls for all agents, but this would allow a slow call (e.g. because of slow service 2975 // RemoveClient() calls for all agents, but this would allow a slow call (e.g. because of slow service
2974 // response in some module listening to AddNewClient()) from holding up unrelated agent calls. 2976 // response in some module listening to AddNewAgent()) from holding up unrelated agent calls.
2975 // 2977 //
2976 // In practice, the lock (this) in LLUDPServer.AddNewClient() currently lock across all 2978 // In practice, the lock (this) in LLUDPServer.AddNewClient() currently lock across all
2977 // AddNewClient() operations (though not other ops). 2979 // AddNewClient() operations (though not other ops).
@@ -2988,7 +2990,7 @@ namespace OpenSim.Region.Framework.Scenes
2988 2990
2989 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this 2991 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this
2990 // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause 2992 // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause
2991 // other problems, and possible the code calling AddNewClient() should ensure that no client is already 2993 // other problems, and possibly the code calling AddNewAgent() should ensure that no client is already
2992 // connected. 2994 // connected.
2993 if (sp == null) 2995 if (sp == null)
2994 { 2996 {
@@ -3021,6 +3023,9 @@ namespace OpenSim.Region.Framework.Scenes
3021 3023
3022 // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the 3024 // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the
3023 // client is for a root or child agent. 3025 // client is for a root or child agent.
3026 // XXX: This may be better set for a new client before that client is added to the client manager.
3027 // But need to know what happens in the case where a ScenePresence is already present (and if this
3028 // actually occurs).
3024 client.SceneAgent = sp; 3029 client.SceneAgent = sp;
3025 3030
3026 // This is currently also being done earlier in NewUserConnection for real users to see if this 3031 // This is currently also being done earlier in NewUserConnection for real users to see if this
@@ -3130,7 +3135,7 @@ namespace OpenSim.Region.Framework.Scenes
3130 { 3135 {
3131 PresenceService.LogoutAgent(sp.ControllingClient.SessionId); 3136 PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
3132 3137
3133 IncomingCloseAgent(sp.UUID, false); 3138 CloseAgent(sp.UUID, false);
3134 } 3139 }
3135 3140
3136 // BANG! SLASH! 3141 // BANG! SLASH!
@@ -3554,7 +3559,7 @@ namespace OpenSim.Region.Framework.Scenes
3554 /// <param name='closeChildAgents'> 3559 /// <param name='closeChildAgents'>
3555 /// Close the neighbour child agents associated with this client. 3560 /// Close the neighbour child agents associated with this client.
3556 /// </param> 3561 /// </param>
3557 public override void RemoveClient(UUID agentID, bool closeChildAgents) 3562 public void RemoveClient(UUID agentID, bool closeChildAgents)
3558 { 3563 {
3559 AgentCircuitData acd = m_authenticateHandler.GetAgentCircuitData(agentID); 3564 AgentCircuitData acd = m_authenticateHandler.GetAgentCircuitData(agentID);
3560 3565
@@ -3940,7 +3945,7 @@ namespace OpenSim.Region.Framework.Scenes
3940 sp.Name, sp.UUID, RegionInfo.RegionName); 3945 sp.Name, sp.UUID, RegionInfo.RegionName);
3941 3946
3942 if (sp.ControllingClient != null) 3947 if (sp.ControllingClient != null)
3943 IncomingCloseAgent(sp.UUID, true); 3948 CloseAgent(sp.UUID, true);
3944 3949
3945 sp = null; 3950 sp = null;
3946 } 3951 }
@@ -4024,19 +4029,6 @@ namespace OpenSim.Region.Framework.Scenes
4024 // Let the SP know how we got here. This has a lot of interesting 4029 // Let the SP know how we got here. This has a lot of interesting
4025 // uses down the line. 4030 // uses down the line.
4026 sp.TeleportFlags = (TPFlags)teleportFlags; 4031 sp.TeleportFlags = (TPFlags)teleportFlags;
4027
4028 // We must carry out a further authorization check if there's an
4029 // attempt to make a child agent into a root agent, since SeeIntoRegion may have allowed a child
4030 // agent to login to a region where a full avatar would not be allowed.
4031 //
4032 // We determine whether this is a CreateAgent for a future non-child agent by inspecting
4033 // TeleportFlags, which will be default for a child connection. This relies on input from the source
4034 // region.
4035 if (sp.TeleportFlags != TPFlags.Default)
4036 {
4037 if (!AuthorizeUser(acd, false, out reason))
4038 return false;
4039 }
4040 4032
4041 if (sp.IsChildAgent) 4033 if (sp.IsChildAgent)
4042 { 4034 {
@@ -4469,7 +4461,7 @@ namespace OpenSim.Region.Framework.Scenes
4469 /// <param name="cAgentData">Agent that contains all of the relevant things about an agent. 4461 /// <param name="cAgentData">Agent that contains all of the relevant things about an agent.
4470 /// Appearance, animations, position, etc.</param> 4462 /// Appearance, animations, position, etc.</param>
4471 /// <returns>true if we handled it.</returns> 4463 /// <returns>true if we handled it.</returns>
4472 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) 4464 public virtual bool IncomingUpdateChildAgent(AgentData cAgentData)
4473 { 4465 {
4474 m_log.DebugFormat( 4466 m_log.DebugFormat(
4475 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); 4467 "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
@@ -4487,7 +4479,7 @@ namespace OpenSim.Region.Framework.Scenes
4487 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); 4479 ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2);
4488 if (nearestParcel == null) 4480 if (nearestParcel == null)
4489 { 4481 {
4490 m_log.DebugFormat( 4482 m_log.InfoFormat(
4491 "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel", 4483 "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel",
4492 cAgentData.AgentID, RegionInfo.RegionName); 4484 cAgentData.AgentID, RegionInfo.RegionName);
4493 4485
@@ -4497,7 +4489,7 @@ namespace OpenSim.Region.Framework.Scenes
4497 // We have to wait until the viewer contacts this region 4489 // We have to wait until the viewer contacts this region
4498 // after receiving the EnableSimulator HTTP Event Queue message (for the v1 teleport protocol) 4490 // after receiving the EnableSimulator HTTP Event Queue message (for the v1 teleport protocol)
4499 // or TeleportFinish (for the v2 teleport protocol). This triggers the viewer to send 4491 // or TeleportFinish (for the v2 teleport protocol). This triggers the viewer to send
4500 // a UseCircuitCode packet which in turn calls AddNewClient which finally creates the ScenePresence. 4492 // a UseCircuitCode packet which in turn calls AddNewAgent which finally creates the ScenePresence.
4501 ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID); 4493 ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID);
4502 4494
4503 if (sp != null) 4495 if (sp != null)
@@ -4512,7 +4504,7 @@ namespace OpenSim.Region.Framework.Scenes
4512 sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID)); 4504 sp.UUID, sp.ControllingClient.SessionId, cAgentData.SessionID));
4513 } 4505 }
4514 4506
4515 sp.ChildAgentDataUpdate(cAgentData); 4507 sp.UpdateChildAgent(cAgentData);
4516 4508
4517 int ntimes = 20; 4509 int ntimes = 20;
4518 if (cAgentData.SenderWantsToWaitForRoot) 4510 if (cAgentData.SenderWantsToWaitForRoot)
@@ -4520,9 +4512,14 @@ namespace OpenSim.Region.Framework.Scenes
4520 while (sp.IsChildAgent && ntimes-- > 0) 4512 while (sp.IsChildAgent && ntimes-- > 0)
4521 Thread.Sleep(1000); 4513 Thread.Sleep(1000);
4522 4514
4523 m_log.DebugFormat( 4515 if (sp.IsChildAgent)
4524 "[SCENE]: Found presence {0} {1} {2} in {3} after {4} waits", 4516 m_log.WarnFormat(
4525 sp.Name, sp.UUID, sp.IsChildAgent ? "child" : "root", Name, 20 - ntimes); 4517 "[SCENE]: Found presence {0} {1} unexpectedly still child in {2}",
4518 sp.Name, sp.UUID, Name);
4519 else
4520 m_log.InfoFormat(
4521 "[SCENE]: Found presence {0} {1} as root in {2} after {3} waits",
4522 sp.Name, sp.UUID, Name, 20 - ntimes);
4526 4523
4527 if (sp.IsChildAgent) 4524 if (sp.IsChildAgent)
4528 return false; 4525 return false;
@@ -4540,7 +4537,7 @@ namespace OpenSim.Region.Framework.Scenes
4540 /// </summary> 4537 /// </summary>
4541 /// <param name="cAgentData">AgentPosition that contains agent positional data so we can know what to send</param> 4538 /// <param name="cAgentData">AgentPosition that contains agent positional data so we can know what to send</param>
4542 /// <returns>true if we handled it.</returns> 4539 /// <returns>true if we handled it.</returns>
4543 public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) 4540 public virtual bool IncomingUpdateChildAgent(AgentPosition cAgentData)
4544 { 4541 {
4545 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); 4542 //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);
4546 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 4543 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
@@ -4560,7 +4557,7 @@ namespace OpenSim.Region.Framework.Scenes
4560 uint tRegionX = RegionInfo.RegionLocX; 4557 uint tRegionX = RegionInfo.RegionLocX;
4561 uint tRegionY = RegionInfo.RegionLocY; 4558 uint tRegionY = RegionInfo.RegionLocY;
4562 //Send Data to ScenePresence 4559 //Send Data to ScenePresence
4563 childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY); 4560 childAgentUpdate.UpdateChildAgent(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY);
4564 // Not Implemented: 4561 // Not Implemented:
4565 //TODO: Do we need to pass the message on to one of our neighbors? 4562 //TODO: Do we need to pass the message on to one of our neighbors?
4566 } 4563 }
@@ -4610,7 +4607,7 @@ namespace OpenSim.Region.Framework.Scenes
4610 /// <param name="force"></param> 4607 /// <param name="force"></param>
4611 /// <param name="auth_token"></param> 4608 /// <param name="auth_token"></param>
4612 /// <returns></returns> 4609 /// <returns></returns>
4613 public bool IncomingCloseAgent(UUID agentID, bool force, string auth_token) 4610 public bool CloseAgent(UUID agentID, bool force, string auth_token)
4614 { 4611 {
4615 //m_log.DebugFormat("[SCENE]: Processing incoming close agent {0} in region {1} with auth_token {2}", agentID, RegionInfo.RegionName, auth_token); 4612 //m_log.DebugFormat("[SCENE]: Processing incoming close agent {0} in region {1} with auth_token {2}", agentID, RegionInfo.RegionName, auth_token);
4616 4613
@@ -4628,7 +4625,7 @@ namespace OpenSim.Region.Framework.Scenes
4628 4625
4629 if (acd.SessionID.ToString() == auth_token) 4626 if (acd.SessionID.ToString() == auth_token)
4630 { 4627 {
4631 return IncomingCloseAgent(agentID, force); 4628 return CloseAgent(agentID, force);
4632 } 4629 }
4633 else 4630 else
4634 { 4631 {
@@ -4640,27 +4637,27 @@ namespace OpenSim.Region.Framework.Scenes
4640 return false; 4637 return false;
4641 } 4638 }
4642 4639
4643 public bool IncomingCloseAgent(UUID agentID) 4640// public bool IncomingCloseAgent(UUID agentID)
4644 { 4641// {
4645 return IncomingCloseAgent(agentID, false); 4642// return IncomingCloseAgent(agentID, false);
4646 } 4643// }
4647 4644
4648 public bool IncomingCloseChildAgent(UUID agentID) 4645// public bool IncomingCloseChildAgent(UUID agentID)
4649 { 4646// {
4650 return IncomingCloseAgent(agentID, true); 4647// return IncomingCloseAgent(agentID, true);
4651 } 4648// }
4652 4649
4653 /// <summary> 4650 /// <summary>
4654 /// Tell a single agent to prepare to close. 4651 /// Tell a single client to prepare to close.
4655 /// </summary> 4652 /// </summary>
4656 /// <remarks> 4653 /// <remarks>
4657 /// This should only be called if we may close the agent but there will be some delay in so doing. Meant for 4654 /// This should only be called if we may close the client but there will be some delay in so doing. Meant for
4658 /// internal use - other callers should almost certainly called IncomingCloseAgent(). 4655 /// internal use - other callers should almost certainly called CloseClient().
4659 /// </remarks> 4656 /// </remarks>
4660 /// <param name="sp"></param> 4657 /// <param name="sp"></param>
4661 /// <returns>true if pre-close state notification was successful. false if the agent 4658 /// <returns>true if pre-close state notification was successful. false if the agent
4662 /// was not in a state where it could transition to pre-close.</returns> 4659 /// was not in a state where it could transition to pre-close.</returns>
4663 public bool IncomingPreCloseAgent(ScenePresence sp) 4660 public bool IncomingPreCloseClient(ScenePresence sp)
4664 { 4661 {
4665 lock (m_removeClientLock) 4662 lock (m_removeClientLock)
4666 { 4663 {
@@ -4702,7 +4699,7 @@ namespace OpenSim.Region.Framework.Scenes
4702 /// Force the agent to close even if it might be in the middle of some other operation. You do not want to 4699 /// Force the agent to close even if it might be in the middle of some other operation. You do not want to
4703 /// force unless you are absolutely sure that the agent is dead and a normal close is not working. 4700 /// force unless you are absolutely sure that the agent is dead and a normal close is not working.
4704 /// </param> 4701 /// </param>
4705 public bool IncomingCloseAgent(UUID agentID, bool force) 4702 public override bool CloseAgent(UUID agentID, bool force)
4706 { 4703 {
4707 ScenePresence sp; 4704 ScenePresence sp;
4708 4705
@@ -4713,7 +4710,7 @@ namespace OpenSim.Region.Framework.Scenes
4713 if (sp == null) 4710 if (sp == null)
4714 { 4711 {
4715 m_log.DebugFormat( 4712 m_log.DebugFormat(
4716 "[SCENE]: Called IncomingCloseAgent() with agent ID {0} but no such presence is in {1}", 4713 "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}",
4717 agentID, Name); 4714 agentID, Name);
4718 4715
4719 return false; 4716 return false;
@@ -4722,7 +4719,7 @@ namespace OpenSim.Region.Framework.Scenes
4722 if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove) 4719 if (sp.LifecycleState != ScenePresenceState.Running && sp.LifecycleState != ScenePresenceState.PreRemove)
4723 { 4720 {
4724 m_log.DebugFormat( 4721 m_log.DebugFormat(
4725 "[SCENE]: Called IncomingCloseAgent() for {0} in {1} but presence is already in state {2}", 4722 "[SCENE]: Called CloseClient() for {0} in {1} but presence is already in state {2}",
4726 sp.Name, Name, sp.LifecycleState); 4723 sp.Name, Name, sp.LifecycleState);
4727 4724
4728 return false; 4725 return false;