diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 3e11db3..e3bd527 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -591,13 +591,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
591 | get { return m_sceneGraph.Entities; } | 591 | get { return m_sceneGraph.Entities; } |
592 | } | 592 | } |
593 | 593 | ||
594 | // can be closest/random/sequence | 594 | |
595 | private string m_SpawnPointRouting = "closest"; | ||
596 | // used in sequence see: SpawnPoint() | 595 | // used in sequence see: SpawnPoint() |
597 | private int m_SpawnPoint; | 596 | private int m_SpawnPoint; |
597 | // can be closest/random/sequence | ||
598 | public string SpawnPointRouting | 598 | public string SpawnPointRouting |
599 | { | 599 | { |
600 | get { return m_SpawnPointRouting; } | 600 | get; private set; |
601 | } | ||
602 | // allow landmarks to pass | ||
603 | public bool TelehubAllowLandmarks | ||
604 | { | ||
605 | get; private set; | ||
601 | } | 606 | } |
602 | 607 | ||
603 | #endregion Properties | 608 | #endregion Properties |
@@ -737,7 +742,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
737 | m_maxPhys = RegionInfo.PhysPrimMax; | 742 | m_maxPhys = RegionInfo.PhysPrimMax; |
738 | } | 743 | } |
739 | 744 | ||
740 | m_SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 745 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
746 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | ||
741 | 747 | ||
742 | // Here, if clamping is requested in either global or | 748 | // Here, if clamping is requested in either global or |
743 | // local config, it will be used | 749 | // local config, it will be used |
@@ -2794,7 +2800,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2794 | if (sp == null) | 2800 | if (sp == null) |
2795 | { | 2801 | { |
2796 | m_log.DebugFormat( | 2802 | m_log.DebugFormat( |
2797 | "[SCENE]: Adding new child scene presence {0} to scene {1} at pos {2}", client.Name, RegionInfo.RegionName, client.StartPos); | 2803 | "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", |
2804 | client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); | ||
2798 | 2805 | ||
2799 | m_clientManager.Add(client); | 2806 | m_clientManager.Add(client); |
2800 | SubscribeToClientEvents(client); | 2807 | SubscribeToClientEvents(client); |
@@ -4098,6 +4105,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4098 | return false; | 4105 | return false; |
4099 | } | 4106 | } |
4100 | 4107 | ||
4108 | // TODO: This check should probably be in QueryAccess(). | ||
4101 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4109 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4102 | if (nearestParcel == null) | 4110 | if (nearestParcel == null) |
4103 | { | 4111 | { |
@@ -4108,14 +4116,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4108 | return false; | 4116 | return false; |
4109 | } | 4117 | } |
4110 | 4118 | ||
4111 | int num = m_sceneGraph.GetNumberOfScenePresences(); | 4119 | // We have to wait until the viewer contacts this region after receiving EAC. |
4112 | 4120 | // That calls AddNewClient, which finally creates the ScenePresence | |
4113 | if (num >= RegionInfo.RegionSettings.AgentLimit) | ||
4114 | { | ||
4115 | if (!Permissions.IsAdministrator(cAgentData.AgentID)) | ||
4116 | return false; | ||
4117 | } | ||
4118 | |||
4119 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); | 4121 | ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); |
4120 | 4122 | ||
4121 | if (childAgentUpdate != null) | 4123 | if (childAgentUpdate != null) |
@@ -4159,14 +4161,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
4159 | return false; | 4161 | return false; |
4160 | } | 4162 | } |
4161 | 4163 | ||
4164 | /// <summary> | ||
4165 | /// Poll until the requested ScenePresence appears or we timeout. | ||
4166 | /// </summary> | ||
4167 | /// <returns>The scene presence is found, else null.</returns> | ||
4168 | /// <param name='agentID'></param> | ||
4162 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4169 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4163 | { | 4170 | { |
4164 | int ntimes = 10; | 4171 | int ntimes = 10; |
4165 | ScenePresence childAgentUpdate = null; | 4172 | ScenePresence sp = null; |
4166 | while ((childAgentUpdate = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4173 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4167 | Thread.Sleep(1000); | 4174 | Thread.Sleep(1000); |
4168 | return childAgentUpdate; | ||
4169 | 4175 | ||
4176 | if (sp == null) | ||
4177 | m_log.WarnFormat( | ||
4178 | "[SCENE PRESENCE]: Did not find presence with id {0} in {1} before timeout", | ||
4179 | agentID, RegionInfo.RegionName); | ||
4180 | // else | ||
4181 | // m_log.DebugFormat( | ||
4182 | // "[SCENE PRESENCE]: Found presence {0} {1} {2} in {3} after {4} waits", | ||
4183 | // sp.Name, sp.UUID, sp.IsChildAgent ? "child" : "root", RegionInfo.RegionName, 10 - ntimes); | ||
4184 | |||
4185 | return sp; | ||
4170 | } | 4186 | } |
4171 | 4187 | ||
4172 | public virtual bool IncomingRetrieveRootAgent(UUID id, out IAgentData agent) | 4188 | public virtual bool IncomingRetrieveRootAgent(UUID id, out IAgentData agent) |
@@ -5493,13 +5509,22 @@ Environment.Exit(1); | |||
5493 | return true; | 5509 | return true; |
5494 | } | 5510 | } |
5495 | 5511 | ||
5496 | int num = m_sceneGraph.GetNumberOfScenePresences(); | 5512 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5513 | // However, the long term fix is to make sure root agent count is always accurate. | ||
5514 | m_sceneGraph.RecalculateStats(); | ||
5515 | |||
5516 | int num = m_sceneGraph.GetRootAgentCount(); | ||
5497 | 5517 | ||
5498 | if (num >= RegionInfo.RegionSettings.AgentLimit) | 5518 | if (num >= RegionInfo.RegionSettings.AgentLimit) |
5499 | { | 5519 | { |
5500 | if (!Permissions.IsAdministrator(agentID)) | 5520 | if (!Permissions.IsAdministrator(agentID)) |
5501 | { | 5521 | { |
5502 | reason = "The region is full"; | 5522 | reason = "The region is full"; |
5523 | |||
5524 | m_log.DebugFormat( | ||
5525 | "[SCENE]: Denying presence with id {0} entry into {1} since region is at agent limit of {2}", | ||
5526 | agentID, RegionInfo.RegionName, RegionInfo.RegionSettings.AgentLimit); | ||
5527 | |||
5503 | return false; | 5528 | return false; |
5504 | } | 5529 | } |
5505 | } | 5530 | } |