aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs45
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs59
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs15
4 files changed, 99 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs
new file mode 100644
index 0000000..ca4ed5c
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IRegionCombinerModule.cs
@@ -0,0 +1,45 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Linq;
31using System.Text;
32using OpenSim.Region.Framework.Scenes;
33using System.IO;
34using OpenMetaverse;
35
36namespace OpenSim.Region.Framework.Interfaces
37{
38 public interface IRegionCombinerModule
39 {
40 /// <summary>
41 /// Does the given id belong to the root region of a megaregion?
42 /// </summary>
43 bool IsRootForMegaregion(UUID sceneId);
44 }
45} \ No newline at end of file
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 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 00f76e0..23a0550 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -860,11 +860,6 @@ namespace OpenSim.Region.Framework.Scenes
860 return m_scenePresenceArray; 860 return m_scenePresenceArray;
861 } 861 }
862 862
863 public int GetNumberOfScenePresences()
864 {
865 return m_scenePresenceArray.Count;
866 }
867
868 /// <summary> 863 /// <summary>
869 /// Request a scene presence by UUID. Fast, indexed lookup. 864 /// Request a scene presence by UUID. Fast, indexed lookup.
870 /// </summary> 865 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 913942f..e0872d0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1299,6 +1299,12 @@ namespace OpenSim.Region.Framework.Scenes
1299 Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); 1299 Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI);
1300 m_callbackURI = null; 1300 m_callbackURI = null;
1301 } 1301 }
1302// else
1303// {
1304// m_log.DebugFormat(
1305// "[SCENE PRESENCE]: No callback provided on CompleteMovement of {0} {1} to {2}",
1306// client.Name, client.AgentId, m_scene.RegionInfo.RegionName);
1307// }
1302 1308
1303 ValidateAndSendAppearanceAndAgentData(); 1309 ValidateAndSendAppearanceAndAgentData();
1304 1310
@@ -2691,7 +2697,7 @@ namespace OpenSim.Region.Framework.Scenes
2691 // If we are using the the cached appearance then send it out to everyone 2697 // If we are using the the cached appearance then send it out to everyone
2692 if (cachedappearance) 2698 if (cachedappearance)
2693 { 2699 {
2694 m_log.DebugFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); 2700 m_log.DebugFormat("[SCENE PRESENCE]: baked textures are in the cache for {0}", Name);
2695 2701
2696 // If the avatars baked textures are all in the cache, then we have a 2702 // If the avatars baked textures are all in the cache, then we have a
2697 // complete appearance... send it out, if not, then we'll send it when 2703 // complete appearance... send it out, if not, then we'll send it when
@@ -3153,7 +3159,7 @@ namespace OpenSim.Region.Framework.Scenes
3153 3159
3154 public void ChildAgentDataUpdate(AgentData cAgentData) 3160 public void ChildAgentDataUpdate(AgentData cAgentData)
3155 { 3161 {
3156 //m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); 3162// m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName);
3157 if (!IsChildAgent) 3163 if (!IsChildAgent)
3158 return; 3164 return;
3159 3165
@@ -3297,6 +3303,9 @@ namespace OpenSim.Region.Framework.Scenes
3297 m_originRegionID = cAgent.RegionID; 3303 m_originRegionID = cAgent.RegionID;
3298 3304
3299 m_callbackURI = cAgent.CallbackURI; 3305 m_callbackURI = cAgent.CallbackURI;
3306// m_log.DebugFormat(
3307// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()",
3308// Name, m_scene.RegionInfo.RegionName, m_callbackURI);
3300 3309
3301 m_pos = cAgent.Position; 3310 m_pos = cAgent.Position;
3302 m_velocity = cAgent.Velocity; 3311 m_velocity = cAgent.Velocity;
@@ -4120,7 +4129,7 @@ namespace OpenSim.Region.Framework.Scenes
4120 { 4129 {
4121 if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == 4130 if ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) ==
4122 (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) || 4131 (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) ||
4123 (m_teleportFlags & TeleportFlags.ViaLandmark) != 0 || 4132 (m_scene.TelehubAllowLandmarks == true ? false : ((m_teleportFlags & TeleportFlags.ViaLandmark) != 0 )) ||
4124 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || 4133 (m_teleportFlags & TeleportFlags.ViaLocation) != 0 ||
4125 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) 4134 (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0)
4126 { 4135 {