diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 867 |
1 files changed, 635 insertions, 232 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8ef22bd..c99e37e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | // TODO: need to figure out how allow client agents but deny | 156 | // TODO: need to figure out how allow client agents but deny |
157 | // root agents when ACL denies access to root agent | 157 | // root agents when ACL denies access to root agent |
158 | public bool m_strictAccessControl = true; | 158 | public bool m_strictAccessControl = true; |
159 | 159 | public bool m_seeIntoBannedRegion = false; | |
160 | public int MaxUndoCount { get; set; } | 160 | public int MaxUndoCount = 5; |
161 | 161 | ||
162 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; | 162 | // Using this for RegionReady module to prevent LoginsDisabled from changing under our feet; |
163 | public bool LoginLock = false; | 163 | public bool LoginLock = false; |
@@ -173,11 +173,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
173 | 173 | ||
174 | protected int m_splitRegionID; | 174 | protected int m_splitRegionID; |
175 | protected Timer m_restartWaitTimer = new Timer(); | 175 | protected Timer m_restartWaitTimer = new Timer(); |
176 | protected Timer m_timerWatchdog = new Timer(); | ||
176 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 177 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
177 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 178 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
178 | protected string m_simulatorVersion = "OpenSimulator Server"; | 179 | protected string m_simulatorVersion = "OpenSimulator Server"; |
179 | protected AgentCircuitManager m_authenticateHandler; | 180 | protected AgentCircuitManager m_authenticateHandler; |
180 | protected SceneCommunicationService m_sceneGridService; | 181 | protected SceneCommunicationService m_sceneGridService; |
182 | protected ISnmpModule m_snmpService = null; | ||
181 | 183 | ||
182 | protected ISimulationDataService m_SimulationDataService; | 184 | protected ISimulationDataService m_SimulationDataService; |
183 | protected IEstateDataService m_EstateDataService; | 185 | protected IEstateDataService m_EstateDataService; |
@@ -240,8 +242,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
240 | private int m_update_presences = 1; // Update scene presence movements | 242 | private int m_update_presences = 1; // Update scene presence movements |
241 | private int m_update_events = 1; | 243 | private int m_update_events = 1; |
242 | private int m_update_backup = 200; | 244 | private int m_update_backup = 200; |
243 | private int m_update_terrain = 50; | 245 | private int m_update_terrain = 1000; |
244 | // private int m_update_land = 1; | 246 | private int m_update_land = 10; |
245 | private int m_update_coarse_locations = 50; | 247 | private int m_update_coarse_locations = 50; |
246 | 248 | ||
247 | private int agentMS; | 249 | private int agentMS; |
@@ -254,13 +256,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
254 | private int backupMS; | 256 | private int backupMS; |
255 | private int terrainMS; | 257 | private int terrainMS; |
256 | private int landMS; | 258 | private int landMS; |
257 | private int spareMS; | ||
258 | 259 | ||
259 | /// <summary> | 260 | /// <summary> |
260 | /// Tick at which the last frame was processed. | 261 | /// Tick at which the last frame was processed. |
261 | /// </summary> | 262 | /// </summary> |
262 | private int m_lastFrameTick; | 263 | private int m_lastFrameTick; |
263 | 264 | ||
265 | public bool CombineRegions = false; | ||
264 | /// <summary> | 266 | /// <summary> |
265 | /// Tick at which the last maintenance run occurred. | 267 | /// Tick at which the last maintenance run occurred. |
266 | /// </summary> | 268 | /// </summary> |
@@ -291,6 +293,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
291 | /// </summary> | 293 | /// </summary> |
292 | private int m_LastLogin; | 294 | private int m_LastLogin; |
293 | 295 | ||
296 | private int m_lastIncoming; | ||
297 | private int m_lastOutgoing; | ||
298 | private int m_hbRestarts = 0; | ||
299 | |||
300 | |||
294 | /// <summary> | 301 | /// <summary> |
295 | /// Thread that runs the scene loop. | 302 | /// Thread that runs the scene loop. |
296 | /// </summary> | 303 | /// </summary> |
@@ -331,7 +338,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
331 | private volatile bool m_active; | 338 | private volatile bool m_active; |
332 | 339 | ||
333 | // private int m_lastUpdate; | 340 | // private int m_lastUpdate; |
334 | // private bool m_firstHeartbeat = true; | 341 | private bool m_firstHeartbeat = true; |
335 | 342 | ||
336 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; | 343 | private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; |
337 | private bool m_reprioritizationEnabled = true; | 344 | private bool m_reprioritizationEnabled = true; |
@@ -376,6 +383,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
376 | get { return m_sceneGridService; } | 383 | get { return m_sceneGridService; } |
377 | } | 384 | } |
378 | 385 | ||
386 | public ISnmpModule SnmpService | ||
387 | { | ||
388 | get | ||
389 | { | ||
390 | if (m_snmpService == null) | ||
391 | { | ||
392 | m_snmpService = RequestModuleInterface<ISnmpModule>(); | ||
393 | } | ||
394 | |||
395 | return m_snmpService; | ||
396 | } | ||
397 | } | ||
398 | |||
379 | public ISimulationDataService SimulationDataService | 399 | public ISimulationDataService SimulationDataService |
380 | { | 400 | { |
381 | get | 401 | get |
@@ -674,6 +694,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
674 | m_SimulationDataService = simDataService; | 694 | m_SimulationDataService = simDataService; |
675 | m_EstateDataService = estateDataService; | 695 | m_EstateDataService = estateDataService; |
676 | m_regionHandle = RegionInfo.RegionHandle; | 696 | m_regionHandle = RegionInfo.RegionHandle; |
697 | m_lastIncoming = 0; | ||
698 | m_lastOutgoing = 0; | ||
677 | 699 | ||
678 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); | 700 | m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); |
679 | m_asyncSceneObjectDeleter.Enabled = true; | 701 | m_asyncSceneObjectDeleter.Enabled = true; |
@@ -756,132 +778,141 @@ namespace OpenSim.Region.Framework.Scenes | |||
756 | 778 | ||
757 | // Region config overrides global config | 779 | // Region config overrides global config |
758 | // | 780 | // |
759 | if (m_config.Configs["Startup"] != null) | 781 | try |
760 | { | 782 | { |
761 | IConfig startupConfig = m_config.Configs["Startup"]; | 783 | if (m_config.Configs["Startup"] != null) |
762 | |||
763 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); | ||
764 | |||
765 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance); | ||
766 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); | ||
767 | if (!m_useBackup) | ||
768 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); | ||
769 | |||
770 | //Animation states | ||
771 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
772 | |||
773 | MaxUndoCount = startupConfig.GetInt("MaxPrimUndos", 20); | ||
774 | |||
775 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | ||
776 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | ||
777 | |||
778 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); | ||
779 | if (RegionInfo.NonphysPrimMin > 0) | ||
780 | { | 784 | { |
781 | m_minNonphys = RegionInfo.NonphysPrimMin; | 785 | IConfig startupConfig = m_config.Configs["Startup"]; |
782 | } | ||
783 | 786 | ||
784 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); | 787 | StartDisabled = startupConfig.GetBoolean("StartDisabled", false); |
785 | if (RegionInfo.NonphysPrimMax > 0) | ||
786 | { | ||
787 | m_maxNonphys = RegionInfo.NonphysPrimMax; | ||
788 | } | ||
789 | 788 | ||
790 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); | 789 | m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); |
791 | if (RegionInfo.PhysPrimMin > 0) | 790 | m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup); |
792 | { | 791 | if (!m_useBackup) |
793 | m_minPhys = RegionInfo.PhysPrimMin; | 792 | m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); |
794 | } | 793 | |
794 | //Animation states | ||
795 | m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); | ||
795 | 796 | ||
796 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 797 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); |
797 | if (RegionInfo.PhysPrimMax > 0) | 798 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); |
798 | { | ||
799 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
800 | } | ||
801 | 799 | ||
802 | // Here, if clamping is requested in either global or | 800 | m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); |
803 | // local config, it will be used | 801 | if (RegionInfo.NonphysPrimMin > 0) |
804 | // | 802 | { |
805 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | 803 | m_minNonphys = RegionInfo.NonphysPrimMin; |
806 | if (RegionInfo.ClampPrimSize) | 804 | } |
807 | { | ||
808 | m_clampPrimSize = true; | ||
809 | } | ||
810 | 805 | ||
811 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); | 806 | m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); |
812 | if (RegionInfo.LinksetCapacity > 0) | 807 | if (RegionInfo.NonphysPrimMax > 0) |
813 | { | 808 | { |
814 | m_linksetCapacity = RegionInfo.LinksetCapacity; | 809 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
815 | } | 810 | } |
816 | 811 | ||
817 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); | 812 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); |
818 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | 813 | if (RegionInfo.PhysPrimMin > 0) |
819 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | 814 | { |
820 | m_dontPersistBefore = | 815 | m_minPhys = RegionInfo.PhysPrimMin; |
821 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | 816 | } |
822 | m_dontPersistBefore *= 10000000; | ||
823 | m_persistAfter = | ||
824 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
825 | m_persistAfter *= 10000000; | ||
826 | 817 | ||
827 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | 818 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); |
828 | 819 | ||
829 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); | 820 | if (RegionInfo.PhysPrimMax > 0) |
830 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); | 821 | { |
822 | m_maxPhys = RegionInfo.PhysPrimMax; | ||
823 | } | ||
831 | 824 | ||
832 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | 825 | m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); |
826 | if (RegionInfo.LinksetCapacity > 0) | ||
827 | { | ||
828 | m_linksetCapacity = RegionInfo.LinksetCapacity; | ||
829 | } | ||
833 | 830 | ||
834 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | 831 | SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); |
835 | if (m_generateMaptiles) | 832 | TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); |
836 | { | 833 | |
837 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); | 834 | // Here, if clamping is requested in either global or |
838 | if (maptileRefresh != 0) | 835 | // local config, it will be used |
836 | // | ||
837 | m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); | ||
838 | if (RegionInfo.ClampPrimSize) | ||
839 | { | 839 | { |
840 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | 840 | m_clampPrimSize = true; |
841 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
842 | m_mapGenerationTimer.AutoReset = true; | ||
843 | m_mapGenerationTimer.Start(); | ||
844 | } | 841 | } |
845 | } | ||
846 | else | ||
847 | { | ||
848 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
849 | UUID tileID; | ||
850 | 842 | ||
851 | if (UUID.TryParse(tile, out tileID)) | 843 | m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); |
844 | m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); | ||
845 | m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); | ||
846 | m_dontPersistBefore = | ||
847 | startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE); | ||
848 | m_dontPersistBefore *= 10000000; | ||
849 | m_persistAfter = | ||
850 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | ||
851 | m_persistAfter *= 10000000; | ||
852 | |||
853 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); | ||
854 | m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine); | ||
855 | |||
856 | m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl); | ||
857 | m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion); | ||
858 | CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false); | ||
859 | |||
860 | m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true); | ||
861 | if (m_generateMaptiles) | ||
852 | { | 862 | { |
853 | RegionInfo.RegionSettings.TerrainImageID = tileID; | 863 | int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); |
864 | if (maptileRefresh != 0) | ||
865 | { | ||
866 | m_mapGenerationTimer.Interval = maptileRefresh * 1000; | ||
867 | m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister; | ||
868 | m_mapGenerationTimer.AutoReset = true; | ||
869 | m_mapGenerationTimer.Start(); | ||
870 | } | ||
854 | } | 871 | } |
855 | } | 872 | else |
873 | { | ||
874 | string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); | ||
875 | UUID tileID; | ||
856 | 876 | ||
857 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | 877 | if (UUID.TryParse(tile, out tileID)) |
858 | if (grant.Length > 0) | 878 | { |
859 | { | 879 | RegionInfo.RegionSettings.TerrainImageID = tileID; |
860 | foreach (string viewer in grant.Split('|')) | 880 | } |
881 | } | ||
882 | |||
883 | string grant = startupConfig.GetString("AllowedClients", String.Empty); | ||
884 | if (grant.Length > 0) | ||
861 | { | 885 | { |
862 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | 886 | foreach (string viewer in grant.Split(',')) |
887 | { | ||
888 | m_AllowedViewers.Add(viewer.Trim().ToLower()); | ||
889 | } | ||
863 | } | 890 | } |
864 | } | ||
865 | 891 | ||
866 | grant = startupConfig.GetString("BannedClients", String.Empty); | 892 | grant = startupConfig.GetString("BannedClients", String.Empty); |
867 | if (grant.Length > 0) | 893 | if (grant.Length > 0) |
868 | { | ||
869 | foreach (string viewer in grant.Split('|')) | ||
870 | { | 894 | { |
871 | m_BannedViewers.Add(viewer.Trim().ToLower()); | 895 | foreach (string viewer in grant.Split(',')) |
896 | { | ||
897 | m_BannedViewers.Add(viewer.Trim().ToLower()); | ||
898 | } | ||
872 | } | 899 | } |
873 | } | ||
874 | 900 | ||
875 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); | 901 | MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); |
876 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); | 902 | m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); |
877 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); | 903 | m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); |
878 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); | 904 | m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement); |
879 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); | 905 | m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events); |
880 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); | 906 | m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects); |
881 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); | 907 | m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics); |
882 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); | 908 | m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences); |
883 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); | 909 | m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain); |
884 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); | 910 | m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning); |
911 | } | ||
912 | } | ||
913 | catch (Exception e) | ||
914 | { | ||
915 | m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); | ||
885 | } | 916 | } |
886 | 917 | ||
887 | // FIXME: Ultimately this should be in a module. | 918 | // FIXME: Ultimately this should be in a module. |
@@ -926,6 +957,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
926 | StatsReporter = new SimStatsReporter(this); | 957 | StatsReporter = new SimStatsReporter(this); |
927 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 958 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
928 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 959 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
960 | |||
961 | MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); | ||
929 | } | 962 | } |
930 | 963 | ||
931 | public Scene(RegionInfo regInfo) : base(regInfo) | 964 | public Scene(RegionInfo regInfo) : base(regInfo) |
@@ -1294,9 +1327,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1294 | // Stop all client threads. | 1327 | // Stop all client threads. |
1295 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1328 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1296 | 1329 | ||
1297 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1330 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1298 | EventManager.TriggerSceneShuttingDown(this); | 1331 | EventManager.TriggerSceneShuttingDown(this); |
1299 | 1332 | ||
1333 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1334 | |||
1300 | EntityBase[] entities = GetEntities(); | 1335 | EntityBase[] entities = GetEntities(); |
1301 | foreach (EntityBase entity in entities) | 1336 | foreach (EntityBase entity in entities) |
1302 | { | 1337 | { |
@@ -1306,6 +1341,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1306 | } | 1341 | } |
1307 | } | 1342 | } |
1308 | 1343 | ||
1344 | m_log.Debug("[SCENE]: Graph close"); | ||
1309 | m_sceneGraph.Close(); | 1345 | m_sceneGraph.Close(); |
1310 | 1346 | ||
1311 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1347 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
@@ -1318,6 +1354,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1318 | // attempt to reference a null or disposed physics scene. | 1354 | // attempt to reference a null or disposed physics scene. |
1319 | if (PhysicsScene != null) | 1355 | if (PhysicsScene != null) |
1320 | { | 1356 | { |
1357 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1321 | PhysicsScene phys = PhysicsScene; | 1358 | PhysicsScene phys = PhysicsScene; |
1322 | // remove the physics engine from both Scene and SceneGraph | 1359 | // remove the physics engine from both Scene and SceneGraph |
1323 | PhysicsScene = null; | 1360 | PhysicsScene = null; |
@@ -1340,11 +1377,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1340 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1377 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1341 | if (m_heartbeatThread != null) | 1378 | if (m_heartbeatThread != null) |
1342 | { | 1379 | { |
1380 | m_hbRestarts++; | ||
1381 | if(m_hbRestarts > 10) | ||
1382 | Environment.Exit(1); | ||
1383 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1384 | |||
1385 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1386 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1387 | //proc.EnableRaisingEvents=false; | ||
1388 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1389 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1390 | //proc.Start(); | ||
1391 | //proc.WaitForExit(); | ||
1392 | //Thread.Sleep(1000); | ||
1393 | //Environment.Exit(1); | ||
1343 | m_heartbeatThread.Abort(); | 1394 | m_heartbeatThread.Abort(); |
1395 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1344 | m_heartbeatThread = null; | 1396 | m_heartbeatThread = null; |
1345 | } | 1397 | } |
1346 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1398 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1347 | 1399 | ||
1400 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1401 | |||
1402 | |||
1348 | m_heartbeatThread | 1403 | m_heartbeatThread |
1349 | = Watchdog.StartThread( | 1404 | = Watchdog.StartThread( |
1350 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1405 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
@@ -1487,16 +1542,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1487 | endFrame = Frame + frames; | 1542 | endFrame = Frame + frames; |
1488 | 1543 | ||
1489 | float physicsFPS = 0f; | 1544 | float physicsFPS = 0f; |
1490 | int previousFrameTick, tmpMS; | 1545 | int tmpMS; |
1491 | int maintc = Util.EnvironmentTickCount(); | 1546 | int previousFrameTick; |
1547 | int maintc; | ||
1548 | int sleepMS; | ||
1549 | int framestart; | ||
1492 | 1550 | ||
1493 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1551 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1494 | { | 1552 | { |
1553 | framestart = Util.EnvironmentTickCount(); | ||
1495 | ++Frame; | 1554 | ++Frame; |
1496 | 1555 | ||
1497 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1556 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1498 | 1557 | ||
1499 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1558 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1500 | 1559 | ||
1501 | try | 1560 | try |
1502 | { | 1561 | { |
@@ -1548,6 +1607,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1548 | m_sceneGraph.UpdatePresences(); | 1607 | m_sceneGraph.UpdatePresences(); |
1549 | 1608 | ||
1550 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1609 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1610 | |||
1551 | 1611 | ||
1552 | // Delete temp-on-rez stuff | 1612 | // Delete temp-on-rez stuff |
1553 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1613 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1629,34 +1689,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1629 | 1689 | ||
1630 | Watchdog.UpdateThread(); | 1690 | Watchdog.UpdateThread(); |
1631 | 1691 | ||
1692 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1693 | |||
1694 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1695 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1696 | StatsReporter.AddFPS(1); | ||
1697 | |||
1698 | StatsReporter.addAgentMS(agentMS); | ||
1699 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1700 | StatsReporter.addOtherMS(otherMS); | ||
1701 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1702 | |||
1632 | previousFrameTick = m_lastFrameTick; | 1703 | previousFrameTick = m_lastFrameTick; |
1633 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1704 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1634 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1705 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1635 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1706 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1636 | 1707 | ||
1708 | m_firstHeartbeat = false; | ||
1709 | |||
1710 | sleepMS = Util.EnvironmentTickCount(); | ||
1711 | |||
1637 | if (tmpMS > 0) | 1712 | if (tmpMS > 0) |
1638 | { | ||
1639 | Thread.Sleep(tmpMS); | 1713 | Thread.Sleep(tmpMS); |
1640 | spareMS += tmpMS; | ||
1641 | } | ||
1642 | 1714 | ||
1643 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | 1715 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1644 | maintc = Util.EnvironmentTickCount(); | 1716 | frameMS = Util.EnvironmentTickCountSubtract(framestart); |
1645 | 1717 | StatsReporter.addSleepMS(sleepMS); | |
1646 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1718 | StatsReporter.addFrameMS(frameMS); |
1647 | 1719 | ||
1648 | // if (Frame%m_update_avatars == 0) | 1720 | // if (Frame%m_update_avatars == 0) |
1649 | // UpdateInWorldTime(); | 1721 | // UpdateInWorldTime(); |
1650 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1651 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1652 | StatsReporter.AddFPS(1); | ||
1653 | 1722 | ||
1654 | StatsReporter.addFrameMS(frameMS); | ||
1655 | StatsReporter.addAgentMS(agentMS); | ||
1656 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1657 | StatsReporter.addOtherMS(otherMS); | ||
1658 | StatsReporter.AddSpareMS(spareMS); | ||
1659 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1660 | 1723 | ||
1661 | // Optionally warn if a frame takes double the amount of time that it should. | 1724 | // Optionally warn if a frame takes double the amount of time that it should. |
1662 | if (DebugUpdates | 1725 | if (DebugUpdates |
@@ -1774,7 +1837,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1774 | msg.fromAgentName = "Server"; | 1837 | msg.fromAgentName = "Server"; |
1775 | msg.dialog = (byte)19; // Object msg | 1838 | msg.dialog = (byte)19; // Object msg |
1776 | msg.fromGroup = false; | 1839 | msg.fromGroup = false; |
1777 | msg.offline = (byte)0; | 1840 | msg.offline = (byte)1; |
1778 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1841 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1779 | msg.Position = Vector3.Zero; | 1842 | msg.Position = Vector3.Zero; |
1780 | msg.RegionID = RegionInfo.RegionID.Guid; | 1843 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -1996,6 +2059,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1996 | EventManager.TriggerPrimsLoaded(this); | 2059 | EventManager.TriggerPrimsLoaded(this); |
1997 | } | 2060 | } |
1998 | 2061 | ||
2062 | public bool SuportsRayCastFiltered() | ||
2063 | { | ||
2064 | if (PhysicsScene == null) | ||
2065 | return false; | ||
2066 | return PhysicsScene.SuportsRaycastWorldFiltered(); | ||
2067 | } | ||
2068 | |||
2069 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
2070 | { | ||
2071 | if (PhysicsScene == null) | ||
2072 | return null; | ||
2073 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | ||
2074 | } | ||
1999 | 2075 | ||
2000 | /// <summary> | 2076 | /// <summary> |
2001 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. | 2077 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. |
@@ -2012,14 +2088,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2012 | /// <returns></returns> | 2088 | /// <returns></returns> |
2013 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2089 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2014 | { | 2090 | { |
2091 | |||
2092 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2093 | Vector3 wpos = Vector3.Zero; | ||
2094 | // Check for water surface intersection from above | ||
2095 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2096 | { | ||
2097 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2098 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2099 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2100 | wpos.Z = wheight; | ||
2101 | } | ||
2102 | |||
2015 | Vector3 pos = Vector3.Zero; | 2103 | Vector3 pos = Vector3.Zero; |
2016 | if (RayEndIsIntersection == (byte)1) | 2104 | if (RayEndIsIntersection == (byte)1) |
2017 | { | 2105 | { |
2018 | pos = RayEnd; | 2106 | pos = RayEnd; |
2019 | return pos; | ||
2020 | } | 2107 | } |
2021 | 2108 | else if (RayTargetID != UUID.Zero) | |
2022 | if (RayTargetID != UUID.Zero) | ||
2023 | { | 2109 | { |
2024 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2110 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2025 | 2111 | ||
@@ -2041,7 +2127,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2041 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2127 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2042 | 2128 | ||
2043 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2129 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2044 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2130 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2045 | float ScaleOffset = 0.5f; | 2131 | float ScaleOffset = 0.5f; |
2046 | 2132 | ||
2047 | // If we hit something | 2133 | // If we hit something |
@@ -2064,13 +2150,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2064 | //pos.Z -= 0.25F; | 2150 | //pos.Z -= 0.25F; |
2065 | 2151 | ||
2066 | } | 2152 | } |
2067 | |||
2068 | return pos; | ||
2069 | } | 2153 | } |
2070 | else | 2154 | else |
2071 | { | 2155 | { |
2072 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2156 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2073 | |||
2074 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2157 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2075 | 2158 | ||
2076 | // Un-comment the following line to print the raytrace results to the console. | 2159 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2079,13 +2162,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2079 | if (ei.HitTF) | 2162 | if (ei.HitTF) |
2080 | { | 2163 | { |
2081 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2164 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2082 | } else | 2165 | } |
2166 | else | ||
2083 | { | 2167 | { |
2084 | // fall back to our stupid functionality | 2168 | // fall back to our stupid functionality |
2085 | pos = RayEnd; | 2169 | pos = RayEnd; |
2086 | } | 2170 | } |
2087 | |||
2088 | return pos; | ||
2089 | } | 2171 | } |
2090 | } | 2172 | } |
2091 | else | 2173 | else |
@@ -2096,8 +2178,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2096 | //increase height so its above the ground. | 2178 | //increase height so its above the ground. |
2097 | //should be getting the normal of the ground at the rez point and using that? | 2179 | //should be getting the normal of the ground at the rez point and using that? |
2098 | pos.Z += scale.Z / 2f; | 2180 | pos.Z += scale.Z / 2f; |
2099 | return pos; | 2181 | // return pos; |
2100 | } | 2182 | } |
2183 | |||
2184 | // check against posible water intercept | ||
2185 | if (wpos.Z > pos.Z) pos = wpos; | ||
2186 | return pos; | ||
2101 | } | 2187 | } |
2102 | 2188 | ||
2103 | 2189 | ||
@@ -2188,12 +2274,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2188 | { | 2274 | { |
2189 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2275 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2190 | { | 2276 | { |
2277 | sceneObject.IsDeleted = false; | ||
2191 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2278 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2192 | return true; | 2279 | return true; |
2193 | } | 2280 | } |
2194 | 2281 | ||
2195 | return false; | 2282 | return false; |
2196 | |||
2197 | } | 2283 | } |
2198 | 2284 | ||
2199 | /// <summary> | 2285 | /// <summary> |
@@ -2285,6 +2371,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2285 | /// </summary> | 2371 | /// </summary> |
2286 | public void DeleteAllSceneObjects() | 2372 | public void DeleteAllSceneObjects() |
2287 | { | 2373 | { |
2374 | DeleteAllSceneObjects(false); | ||
2375 | } | ||
2376 | |||
2377 | /// <summary> | ||
2378 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2379 | /// </summary> | ||
2380 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2381 | { | ||
2382 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2288 | lock (Entities) | 2383 | lock (Entities) |
2289 | { | 2384 | { |
2290 | EntityBase[] entities = Entities.GetEntities(); | 2385 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2293,11 +2388,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2293 | if (e is SceneObjectGroup) | 2388 | if (e is SceneObjectGroup) |
2294 | { | 2389 | { |
2295 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2390 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2296 | if (!sog.IsAttachment) | 2391 | if (sog != null && !sog.IsAttachment) |
2297 | DeleteSceneObject((SceneObjectGroup)e, false); | 2392 | { |
2393 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2394 | { | ||
2395 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2396 | } | ||
2397 | else | ||
2398 | { | ||
2399 | toReturn.Add((SceneObjectGroup)e); | ||
2400 | } | ||
2401 | } | ||
2298 | } | 2402 | } |
2299 | } | 2403 | } |
2300 | } | 2404 | } |
2405 | if (toReturn.Count > 0) | ||
2406 | { | ||
2407 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2408 | } | ||
2301 | } | 2409 | } |
2302 | 2410 | ||
2303 | /// <summary> | 2411 | /// <summary> |
@@ -2332,6 +2440,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2332 | 2440 | ||
2333 | foreach (SceneObjectPart part in partList) | 2441 | foreach (SceneObjectPart part in partList) |
2334 | { | 2442 | { |
2443 | if (part.KeyframeMotion != null) | ||
2444 | { | ||
2445 | part.KeyframeMotion.Delete(); | ||
2446 | part.KeyframeMotion = null; | ||
2447 | } | ||
2448 | |||
2335 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2449 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2336 | { | 2450 | { |
2337 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2451 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
@@ -2349,6 +2463,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2349 | } | 2463 | } |
2350 | 2464 | ||
2351 | group.DeleteGroupFromScene(silent); | 2465 | group.DeleteGroupFromScene(silent); |
2466 | if (!silent) | ||
2467 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2352 | 2468 | ||
2353 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2469 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2354 | } | 2470 | } |
@@ -2639,7 +2755,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2639 | // If the user is banned, we won't let any of their objects | 2755 | // If the user is banned, we won't let any of their objects |
2640 | // enter. Period. | 2756 | // enter. Period. |
2641 | // | 2757 | // |
2642 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | 2758 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) |
2643 | { | 2759 | { |
2644 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | 2760 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); |
2645 | return false; | 2761 | return false; |
@@ -2647,6 +2763,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2647 | 2763 | ||
2648 | if (newPosition != Vector3.Zero) | 2764 | if (newPosition != Vector3.Zero) |
2649 | newObject.RootPart.GroupPosition = newPosition; | 2765 | newObject.RootPart.GroupPosition = newPosition; |
2766 | if (newObject.RootPart.KeyframeMotion != null) | ||
2767 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2650 | 2768 | ||
2651 | if (!AddSceneObject(newObject)) | 2769 | if (!AddSceneObject(newObject)) |
2652 | { | 2770 | { |
@@ -2691,6 +2809,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2691 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2809 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2692 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2810 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2693 | { | 2811 | { |
2812 | if (sceneObject.OwnerID == UUID.Zero) | ||
2813 | { | ||
2814 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2815 | return false; | ||
2816 | } | ||
2817 | |||
2818 | // If the user is banned, we won't let any of their objects | ||
2819 | // enter. Period. | ||
2820 | // | ||
2821 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
2822 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2823 | { | ||
2824 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
2825 | |||
2826 | return false; | ||
2827 | } | ||
2828 | |||
2694 | // Force allocation of new LocalId | 2829 | // Force allocation of new LocalId |
2695 | // | 2830 | // |
2696 | SceneObjectPart[] parts = sceneObject.Parts; | 2831 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2724,16 +2859,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2724 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2859 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2725 | 2860 | ||
2726 | if (AttachmentsModule != null) | 2861 | if (AttachmentsModule != null) |
2727 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); | 2862 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false); |
2728 | } | 2863 | } |
2729 | else | 2864 | else |
2730 | { | 2865 | { |
2866 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2731 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2867 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2732 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2868 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2733 | } | 2869 | } |
2870 | if (sceneObject.OwnerID == UUID.Zero) | ||
2871 | { | ||
2872 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2873 | return false; | ||
2874 | } | ||
2734 | } | 2875 | } |
2735 | else | 2876 | else |
2736 | { | 2877 | { |
2878 | if (sceneObject.OwnerID == UUID.Zero) | ||
2879 | { | ||
2880 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2881 | return false; | ||
2882 | } | ||
2737 | AddRestoredSceneObject(sceneObject, true, false); | 2883 | AddRestoredSceneObject(sceneObject, true, false); |
2738 | } | 2884 | } |
2739 | 2885 | ||
@@ -2750,6 +2896,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2750 | return 2; // StateSource.PrimCrossing | 2896 | return 2; // StateSource.PrimCrossing |
2751 | } | 2897 | } |
2752 | 2898 | ||
2899 | public int GetUserFlags(UUID user) | ||
2900 | { | ||
2901 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2902 | /* | ||
2903 | ScenePresence sp; | ||
2904 | if (TryGetScenePresence(user, out sp)) | ||
2905 | { | ||
2906 | return sp.UserFlags; | ||
2907 | } | ||
2908 | else | ||
2909 | { | ||
2910 | */ | ||
2911 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2912 | if (uac == null) | ||
2913 | return 0; | ||
2914 | return uac.UserFlags; | ||
2915 | //} | ||
2916 | } | ||
2753 | #endregion | 2917 | #endregion |
2754 | 2918 | ||
2755 | #region Add/Remove Avatar Methods | 2919 | #region Add/Remove Avatar Methods |
@@ -2782,7 +2946,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2782 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2946 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2783 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2947 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2784 | 2948 | ||
2785 | // CheckHeartbeat(); | 2949 | CheckHeartbeat(); |
2786 | 2950 | ||
2787 | sp = GetScenePresence(client.AgentId); | 2951 | sp = GetScenePresence(client.AgentId); |
2788 | 2952 | ||
@@ -2926,19 +3090,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2926 | // and the scene presence and the client, if they exist | 3090 | // and the scene presence and the client, if they exist |
2927 | try | 3091 | try |
2928 | { | 3092 | { |
2929 | // We need to wait for the client to make UDP contact first. | 3093 | ScenePresence sp = GetScenePresence(agentID); |
2930 | // It's the UDP contact that creates the scene presence | 3094 | |
2931 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2932 | if (sp != null) | 3095 | if (sp != null) |
2933 | { | 3096 | { |
2934 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3097 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2935 | |||
2936 | sp.ControllingClient.Close(); | 3098 | sp.ControllingClient.Close(); |
2937 | } | 3099 | } |
2938 | else | 3100 | |
2939 | { | ||
2940 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2941 | } | ||
2942 | // BANG! SLASH! | 3101 | // BANG! SLASH! |
2943 | m_authenticateHandler.RemoveCircuit(agentID); | 3102 | m_authenticateHandler.RemoveCircuit(agentID); |
2944 | 3103 | ||
@@ -2983,6 +3142,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2983 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3142 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2984 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3143 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2985 | 3144 | ||
3145 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3146 | |||
2986 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3147 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2987 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3148 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2988 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3149 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3039,6 +3200,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3200 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3040 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3201 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3041 | client.OnCopyInventoryItem += CopyInventoryItem; | 3202 | client.OnCopyInventoryItem += CopyInventoryItem; |
3203 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3042 | client.OnMoveInventoryItem += MoveInventoryItem; | 3204 | client.OnMoveInventoryItem += MoveInventoryItem; |
3043 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3205 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3044 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3206 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3110,6 +3272,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3110 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3272 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3111 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3273 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3112 | 3274 | ||
3275 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3276 | |||
3113 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3277 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3114 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3278 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3115 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3279 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3212,7 +3376,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3212 | /// </summary> | 3376 | /// </summary> |
3213 | /// <param name="agentId">The avatar's Unique ID</param> | 3377 | /// <param name="agentId">The avatar's Unique ID</param> |
3214 | /// <param name="client">The IClientAPI for the client</param> | 3378 | /// <param name="client">The IClientAPI for the client</param> |
3215 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3379 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3216 | { | 3380 | { |
3217 | if (EntityTransferModule != null) | 3381 | if (EntityTransferModule != null) |
3218 | { | 3382 | { |
@@ -3223,6 +3387,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3223 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3387 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3224 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3388 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3225 | } | 3389 | } |
3390 | return false; | ||
3226 | } | 3391 | } |
3227 | 3392 | ||
3228 | /// <summary> | 3393 | /// <summary> |
@@ -3332,6 +3497,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3332 | /// <param name="flags"></param> | 3497 | /// <param name="flags"></param> |
3333 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3498 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3334 | { | 3499 | { |
3500 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3501 | ScenePresence presence; | ||
3502 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3503 | { | ||
3504 | if (presence.Appearance != null) | ||
3505 | { | ||
3506 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3507 | } | ||
3508 | } | ||
3509 | |||
3335 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3510 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3336 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3511 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3337 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3512 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3469,6 +3644,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3469 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3644 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3470 | if (AgentTransactionsModule != null) | 3645 | if (AgentTransactionsModule != null) |
3471 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3646 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3647 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3472 | } | 3648 | } |
3473 | catch (Exception e) | 3649 | catch (Exception e) |
3474 | { | 3650 | { |
@@ -3661,38 +3837,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3661 | agent.firstname, agent.lastname, agent.Viewer); | 3837 | agent.firstname, agent.lastname, agent.Viewer); |
3662 | reason = "Access denied, your viewer is banned by the region owner"; | 3838 | reason = "Access denied, your viewer is banned by the region owner"; |
3663 | return false; | 3839 | return false; |
3664 | } | 3840 | } |
3841 | |||
3842 | |||
3843 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3665 | 3844 | ||
3666 | ILandObject land; | 3845 | if (sp != null && !sp.IsChildAgent) |
3846 | { | ||
3847 | // We have a zombie from a crashed session. | ||
3848 | // Or the same user is trying to be root twice here, won't work. | ||
3849 | // Kill it. | ||
3850 | m_log.WarnFormat( | ||
3851 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3852 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3853 | |||
3854 | sp.ControllingClient.Close(true, true); | ||
3855 | sp = null; | ||
3856 | } | ||
3667 | 3857 | ||
3668 | lock (agent) | 3858 | lock (agent) |
3669 | { | 3859 | { |
3670 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3671 | |||
3672 | if (sp != null && !sp.IsChildAgent) | ||
3673 | { | ||
3674 | // We have a zombie from a crashed session. | ||
3675 | // Or the same user is trying to be root twice here, won't work. | ||
3676 | // Kill it. | ||
3677 | m_log.WarnFormat( | ||
3678 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3679 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3680 | |||
3681 | sp.ControllingClient.Close(true); | ||
3682 | sp = null; | ||
3683 | } | ||
3684 | |||
3685 | land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3686 | |||
3687 | //On login test land permisions | 3860 | //On login test land permisions |
3688 | if (vialogin) | 3861 | if (vialogin) |
3689 | { | 3862 | { |
3690 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3863 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3864 | if (cache != null) | ||
3865 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3866 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3691 | { | 3867 | { |
3868 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3692 | return false; | 3869 | return false; |
3693 | } | 3870 | } |
3694 | } | 3871 | } |
3695 | 3872 | ||
3696 | if (sp == null) // We don't have an [child] agent here already | 3873 | if (sp == null) // We don't have an [child] agent here already |
3697 | { | 3874 | { |
3698 | if (requirePresenceLookup) | 3875 | if (requirePresenceLookup) |
@@ -3701,34 +3878,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3701 | { | 3878 | { |
3702 | if (!VerifyUserPresence(agent, out reason)) | 3879 | if (!VerifyUserPresence(agent, out reason)) |
3703 | return false; | 3880 | return false; |
3704 | } | 3881 | } catch (Exception e) |
3705 | catch (Exception e) | ||
3706 | { | 3882 | { |
3707 | m_log.ErrorFormat( | 3883 | m_log.ErrorFormat( |
3708 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3884 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3709 | |||
3710 | return false; | 3885 | return false; |
3711 | } | 3886 | } |
3712 | } | 3887 | } |
3713 | 3888 | ||
3714 | try | 3889 | try |
3715 | { | 3890 | { |
3716 | if (!AuthorizeUser(agent, out reason)) | 3891 | // Always check estate if this is a login. Always |
3717 | return false; | 3892 | // check if banned regions are to be blacked out. |
3893 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3894 | { | ||
3895 | if (!AuthorizeUser(agent, out reason)) | ||
3896 | return false; | ||
3897 | } | ||
3718 | } | 3898 | } |
3719 | catch (Exception e) | 3899 | catch (Exception e) |
3720 | { | 3900 | { |
3721 | m_log.ErrorFormat( | 3901 | m_log.ErrorFormat( |
3722 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3902 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3723 | |||
3724 | return false; | 3903 | return false; |
3725 | } | 3904 | } |
3726 | 3905 | ||
3727 | m_log.InfoFormat( | 3906 | m_log.InfoFormat( |
3728 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3907 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3729 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3908 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3730 | agent.AgentID, agent.circuitcode); | 3909 | agent.AgentID, agent.circuitcode); |
3731 | 3910 | ||
3732 | if (CapsModule != null) | 3911 | if (CapsModule != null) |
3733 | { | 3912 | { |
3734 | CapsModule.SetAgentCapsSeeds(agent); | 3913 | CapsModule.SetAgentCapsSeeds(agent); |
@@ -3740,15 +3919,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3740 | // Let the SP know how we got here. This has a lot of interesting | 3919 | // Let the SP know how we got here. This has a lot of interesting |
3741 | // uses down the line. | 3920 | // uses down the line. |
3742 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3921 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3743 | 3922 | ||
3744 | if (sp.IsChildAgent) | 3923 | if (sp.IsChildAgent) |
3745 | { | 3924 | { |
3746 | m_log.DebugFormat( | 3925 | m_log.DebugFormat( |
3747 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3926 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3748 | agent.AgentID, RegionInfo.RegionName); | 3927 | agent.AgentID, RegionInfo.RegionName); |
3749 | 3928 | ||
3750 | sp.AdjustKnownSeeds(); | 3929 | sp.AdjustKnownSeeds(); |
3751 | 3930 | ||
3752 | if (CapsModule != null) | 3931 | if (CapsModule != null) |
3753 | CapsModule.SetAgentCapsSeeds(agent); | 3932 | CapsModule.SetAgentCapsSeeds(agent); |
3754 | } | 3933 | } |
@@ -3850,6 +4029,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3850 | } | 4029 | } |
3851 | 4030 | ||
3852 | // Honor parcel landing type and position. | 4031 | // Honor parcel landing type and position. |
4032 | /* | ||
4033 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3853 | if (land != null) | 4034 | if (land != null) |
3854 | { | 4035 | { |
3855 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4036 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3857,25 +4038,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3857 | agent.startpos = land.LandData.UserLocation; | 4038 | agent.startpos = land.LandData.UserLocation; |
3858 | } | 4039 | } |
3859 | } | 4040 | } |
4041 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3860 | } | 4042 | } |
3861 | 4043 | ||
3862 | return true; | 4044 | return true; |
3863 | } | 4045 | } |
3864 | 4046 | ||
3865 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 4047 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3866 | { | 4048 | { |
3867 | bool banned = land.IsBannedFromLand(agent.AgentID); | 4049 | if (posX < 0) |
3868 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 4050 | posX = 0; |
4051 | else if (posX >= 256) | ||
4052 | posX = 255.999f; | ||
4053 | if (posY < 0) | ||
4054 | posY = 0; | ||
4055 | else if (posY >= 256) | ||
4056 | posY = 255.999f; | ||
4057 | |||
4058 | reason = String.Empty; | ||
4059 | if (Permissions.IsGod(agentID)) | ||
4060 | return true; | ||
4061 | |||
4062 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
4063 | if (land == null) | ||
4064 | return false; | ||
4065 | |||
4066 | bool banned = land.IsBannedFromLand(agentID); | ||
4067 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3869 | 4068 | ||
3870 | if (banned || restricted) | 4069 | if (banned || restricted) |
3871 | { | 4070 | { |
3872 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 4071 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3873 | if (nearestParcel != null) | 4072 | if (nearestParcel != null) |
3874 | { | 4073 | { |
3875 | //Move agent to nearest allowed | 4074 | //Move agent to nearest allowed |
3876 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4075 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3877 | agent.startpos.X = newPosition.X; | 4076 | posX = newPosition.X; |
3878 | agent.startpos.Y = newPosition.Y; | 4077 | posY = newPosition.Y; |
3879 | } | 4078 | } |
3880 | else | 4079 | else |
3881 | { | 4080 | { |
@@ -3937,7 +4136,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3937 | 4136 | ||
3938 | if (!m_strictAccessControl) return true; | 4137 | if (!m_strictAccessControl) return true; |
3939 | if (Permissions.IsGod(agent.AgentID)) return true; | 4138 | if (Permissions.IsGod(agent.AgentID)) return true; |
3940 | 4139 | ||
3941 | if (AuthorizationService != null) | 4140 | if (AuthorizationService != null) |
3942 | { | 4141 | { |
3943 | if (!AuthorizationService.IsAuthorizedForRegion( | 4142 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3952,7 +4151,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3952 | 4151 | ||
3953 | if (RegionInfo.EstateSettings != null) | 4152 | if (RegionInfo.EstateSettings != null) |
3954 | { | 4153 | { |
3955 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4154 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0)) |
3956 | { | 4155 | { |
3957 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4156 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3958 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4157 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4142,6 +4341,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4142 | 4341 | ||
4143 | // XPTO: if this agent is not allowed here as root, always return false | 4342 | // XPTO: if this agent is not allowed here as root, always return false |
4144 | 4343 | ||
4344 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4345 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4346 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4347 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4348 | { | ||
4349 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4350 | return false; | ||
4351 | } | ||
4352 | |||
4145 | // TODO: This check should probably be in QueryAccess(). | 4353 | // TODO: This check should probably be in QueryAccess(). |
4146 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4354 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4147 | if (nearestParcel == null) | 4355 | if (nearestParcel == null) |
@@ -4206,7 +4414,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4206 | /// <param name='agentID'></param> | 4414 | /// <param name='agentID'></param> |
4207 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4415 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4208 | { | 4416 | { |
4209 | int ntimes = 10; | 4417 | int ntimes = 30; |
4210 | ScenePresence sp = null; | 4418 | ScenePresence sp = null; |
4211 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4419 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4212 | Thread.Sleep(1000); | 4420 | Thread.Sleep(1000); |
@@ -4236,6 +4444,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4236 | return false; | 4444 | return false; |
4237 | } | 4445 | } |
4238 | 4446 | ||
4447 | public bool IncomingCloseAgent(UUID agentID) | ||
4448 | { | ||
4449 | return IncomingCloseAgent(agentID, false); | ||
4450 | } | ||
4451 | |||
4452 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4453 | { | ||
4454 | return IncomingCloseAgent(agentID, true); | ||
4455 | } | ||
4456 | |||
4239 | /// <summary> | 4457 | /// <summary> |
4240 | /// Tell a single agent to disconnect from the region. | 4458 | /// Tell a single agent to disconnect from the region. |
4241 | /// </summary> | 4459 | /// </summary> |
@@ -4251,7 +4469,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4251 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4469 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4252 | if (presence != null) | 4470 | if (presence != null) |
4253 | { | 4471 | { |
4254 | presence.ControllingClient.Close(force); | 4472 | presence.ControllingClient.Close(force, force); |
4255 | return true; | 4473 | return true; |
4256 | } | 4474 | } |
4257 | 4475 | ||
@@ -4911,35 +5129,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4911 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5129 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
4912 | } | 5130 | } |
4913 | 5131 | ||
4914 | public int GetHealth() | 5132 | public int GetHealth(out int flags, out string message) |
4915 | { | 5133 | { |
4916 | // Returns: | 5134 | // Returns: |
4917 | // 1 = sim is up and accepting http requests. The heartbeat has | 5135 | // 1 = sim is up and accepting http requests. The heartbeat has |
4918 | // stopped and the sim is probably locked up, but a remote | 5136 | // stopped and the sim is probably locked up, but a remote |
4919 | // admin restart may succeed | 5137 | // admin restart may succeed |
4920 | // | 5138 | // |
4921 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5139 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4922 | // usable for people within and logins _may_ work | 5140 | // usable for people within |
5141 | // | ||
5142 | // 3 = Sim is up and one packet thread is running. Sim is | ||
5143 | // unstable and will not accept new logins | ||
4923 | // | 5144 | // |
4924 | // 3 = We have seen a new user enter within the past 4 minutes | 5145 | // 4 = Sim is up and both packet threads are running. Sim is |
5146 | // likely usable | ||
5147 | // | ||
5148 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4925 | // which can be seen as positive confirmation of sim health | 5149 | // which can be seen as positive confirmation of sim health |
4926 | // | 5150 | // |
5151 | |||
5152 | flags = 0; | ||
5153 | message = String.Empty; | ||
5154 | |||
5155 | CheckHeartbeat(); | ||
5156 | |||
5157 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5158 | { | ||
5159 | // We're still starting | ||
5160 | // 0 means "in startup", it can't happen another way, since | ||
5161 | // to get here, we must be able to accept http connections | ||
5162 | return 0; | ||
5163 | } | ||
5164 | |||
4927 | int health=1; // Start at 1, means we're up | 5165 | int health=1; // Start at 1, means we're up |
4928 | 5166 | ||
4929 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5167 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4930 | health += 1; | 5168 | { |
5169 | health+=1; | ||
5170 | flags |= 1; | ||
5171 | } | ||
5172 | |||
5173 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5174 | { | ||
5175 | health+=1; | ||
5176 | flags |= 2; | ||
5177 | } | ||
5178 | |||
5179 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5180 | { | ||
5181 | health+=1; | ||
5182 | flags |= 4; | ||
5183 | } | ||
4931 | else | 5184 | else |
5185 | { | ||
5186 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5187 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5188 | proc.EnableRaisingEvents=false; | ||
5189 | proc.StartInfo.FileName = "/bin/kill"; | ||
5190 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5191 | proc.Start(); | ||
5192 | proc.WaitForExit(); | ||
5193 | Thread.Sleep(1000); | ||
5194 | Environment.Exit(1); | ||
5195 | } | ||
5196 | |||
5197 | if (flags != 7) | ||
4932 | return health; | 5198 | return health; |
4933 | 5199 | ||
4934 | // A login in the last 4 mins? We can't be doing too badly | 5200 | // A login in the last 4 mins? We can't be doing too badly |
4935 | // | 5201 | // |
4936 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5202 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4937 | health++; | 5203 | health++; |
4938 | else | 5204 | else |
4939 | return health; | 5205 | return health; |
4940 | 5206 | ||
4941 | // CheckHeartbeat(); | ||
4942 | |||
4943 | return health; | 5207 | return health; |
4944 | } | 5208 | } |
4945 | 5209 | ||
@@ -5027,7 +5291,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5027 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5291 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5028 | if (wasUsingPhysics) | 5292 | if (wasUsingPhysics) |
5029 | { | 5293 | { |
5030 | jointProxyObject.UpdatePrimFlags(false, false, true, false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock | 5294 | jointProxyObject.UpdatePrimFlags(false, false, true, false,false); // FIXME: possible deadlock here; check to make sure all the scene alterations set into motion here won't deadlock |
5031 | } | 5295 | } |
5032 | } | 5296 | } |
5033 | 5297 | ||
@@ -5126,14 +5390,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5126 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5390 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5127 | } | 5391 | } |
5128 | 5392 | ||
5129 | // private void CheckHeartbeat() | 5393 | private void CheckHeartbeat() |
5130 | // { | 5394 | { |
5131 | // if (m_firstHeartbeat) | 5395 | if (m_firstHeartbeat) |
5132 | // return; | 5396 | return; |
5133 | // | 5397 | |
5134 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5398 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5135 | // StartTimer(); | 5399 | Start(); |
5136 | // } | 5400 | } |
5137 | 5401 | ||
5138 | public override ISceneObject DeserializeObject(string representation) | 5402 | public override ISceneObject DeserializeObject(string representation) |
5139 | { | 5403 | { |
@@ -5145,9 +5409,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5145 | get { return m_allowScriptCrossings; } | 5409 | get { return m_allowScriptCrossings; } |
5146 | } | 5410 | } |
5147 | 5411 | ||
5148 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5412 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5149 | { | 5413 | { |
5150 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5414 | return GetNearestAllowedPosition(avatar, null); |
5415 | } | ||
5416 | |||
5417 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
5418 | { | ||
5419 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
5151 | 5420 | ||
5152 | if (nearestParcel != null) | 5421 | if (nearestParcel != null) |
5153 | { | 5422 | { |
@@ -5156,10 +5425,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5156 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5425 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5157 | if (nearestPoint != null) | 5426 | if (nearestPoint != null) |
5158 | { | 5427 | { |
5159 | // m_log.DebugFormat( | 5428 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5160 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
5161 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
5162 | |||
5163 | return nearestPoint.Value; | 5429 | return nearestPoint.Value; |
5164 | } | 5430 | } |
5165 | 5431 | ||
@@ -5169,17 +5435,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5169 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5435 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5170 | if (nearestPoint != null) | 5436 | if (nearestPoint != null) |
5171 | { | 5437 | { |
5172 | // m_log.DebugFormat( | 5438 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5173 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
5174 | |||
5175 | return nearestPoint.Value; | 5439 | return nearestPoint.Value; |
5176 | } | 5440 | } |
5177 | 5441 | ||
5178 | //Ultimate backup if we have no idea where they are | 5442 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5179 | // m_log.DebugFormat( | 5443 | if (dest != excludeParcel) |
5180 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5444 | { |
5445 | // Ultimate backup if we have no idea where they are and | ||
5446 | // the last allowed position was in another parcel | ||
5447 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5448 | return avatar.lastKnownAllowedPosition; | ||
5449 | } | ||
5181 | 5450 | ||
5182 | return avatar.lastKnownAllowedPosition; | 5451 | // else fall through to region edge |
5183 | } | 5452 | } |
5184 | 5453 | ||
5185 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5454 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -5213,13 +5482,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5213 | 5482 | ||
5214 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5483 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
5215 | { | 5484 | { |
5485 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5486 | } | ||
5487 | |||
5488 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5489 | { | ||
5216 | List<ILandObject> all = AllParcels(); | 5490 | List<ILandObject> all = AllParcels(); |
5217 | float minParcelDistance = float.MaxValue; | 5491 | float minParcelDistance = float.MaxValue; |
5218 | ILandObject nearestParcel = null; | 5492 | ILandObject nearestParcel = null; |
5219 | 5493 | ||
5220 | foreach (var parcel in all) | 5494 | foreach (var parcel in all) |
5221 | { | 5495 | { |
5222 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5496 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
5223 | { | 5497 | { |
5224 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5498 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
5225 | if (parcelDistance < minParcelDistance) | 5499 | if (parcelDistance < minParcelDistance) |
@@ -5461,7 +5735,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5461 | mapModule.GenerateMaptile(); | 5735 | mapModule.GenerateMaptile(); |
5462 | } | 5736 | } |
5463 | 5737 | ||
5464 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5738 | // public void CleanDroppedAttachments() |
5739 | // { | ||
5740 | // List<SceneObjectGroup> objectsToDelete = | ||
5741 | // new List<SceneObjectGroup>(); | ||
5742 | // | ||
5743 | // lock (m_cleaningAttachments) | ||
5744 | // { | ||
5745 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5746 | // { | ||
5747 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5748 | // { | ||
5749 | // UUID agentID = grp.OwnerID; | ||
5750 | // if (agentID == UUID.Zero) | ||
5751 | // { | ||
5752 | // objectsToDelete.Add(grp); | ||
5753 | // return; | ||
5754 | // } | ||
5755 | // | ||
5756 | // ScenePresence sp = GetScenePresence(agentID); | ||
5757 | // if (sp == null) | ||
5758 | // { | ||
5759 | // objectsToDelete.Add(grp); | ||
5760 | // return; | ||
5761 | // } | ||
5762 | // } | ||
5763 | // }); | ||
5764 | // } | ||
5765 | // | ||
5766 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5767 | // { | ||
5768 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5769 | // DeleteSceneObject(grp, true); | ||
5770 | // } | ||
5771 | // } | ||
5772 | |||
5773 | public void ThreadAlive(int threadCode) | ||
5774 | { | ||
5775 | switch(threadCode) | ||
5776 | { | ||
5777 | case 1: // Incoming | ||
5778 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5779 | break; | ||
5780 | case 2: // Incoming | ||
5781 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5782 | break; | ||
5783 | } | ||
5784 | } | ||
5785 | |||
5786 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5465 | { | 5787 | { |
5466 | RegenerateMaptile(); | 5788 | RegenerateMaptile(); |
5467 | 5789 | ||
@@ -5489,6 +5811,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5489 | /// <returns></returns> | 5811 | /// <returns></returns> |
5490 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5812 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5491 | { | 5813 | { |
5814 | reason = "You are banned from the region"; | ||
5815 | |||
5492 | if (EntityTransferModule.IsInTransit(agentID)) | 5816 | if (EntityTransferModule.IsInTransit(agentID)) |
5493 | { | 5817 | { |
5494 | reason = "Agent is still in transit from this region"; | 5818 | reason = "Agent is still in transit from this region"; |
@@ -5500,6 +5824,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5500 | return false; | 5824 | return false; |
5501 | } | 5825 | } |
5502 | 5826 | ||
5827 | if (Permissions.IsGod(agentID)) | ||
5828 | { | ||
5829 | reason = String.Empty; | ||
5830 | return true; | ||
5831 | } | ||
5832 | |||
5503 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5833 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5504 | // However, the long term fix is to make sure root agent count is always accurate. | 5834 | // However, the long term fix is to make sure root agent count is always accurate. |
5505 | m_sceneGraph.RecalculateStats(); | 5835 | m_sceneGraph.RecalculateStats(); |
@@ -5520,6 +5850,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5520 | } | 5850 | } |
5521 | } | 5851 | } |
5522 | 5852 | ||
5853 | ScenePresence presence = GetScenePresence(agentID); | ||
5854 | IClientAPI client = null; | ||
5855 | AgentCircuitData aCircuit = null; | ||
5856 | |||
5857 | if (presence != null) | ||
5858 | { | ||
5859 | client = presence.ControllingClient; | ||
5860 | if (client != null) | ||
5861 | aCircuit = client.RequestClientInfo(); | ||
5862 | } | ||
5863 | |||
5864 | // We may be called before there is a presence or a client. | ||
5865 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5866 | if (client == null) | ||
5867 | { | ||
5868 | aCircuit = new AgentCircuitData(); | ||
5869 | aCircuit.AgentID = agentID; | ||
5870 | aCircuit.firstname = String.Empty; | ||
5871 | aCircuit.lastname = String.Empty; | ||
5872 | } | ||
5873 | |||
5874 | try | ||
5875 | { | ||
5876 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5877 | { | ||
5878 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5879 | return false; | ||
5880 | } | ||
5881 | } | ||
5882 | catch (Exception e) | ||
5883 | { | ||
5884 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5885 | return false; | ||
5886 | } | ||
5887 | |||
5523 | if (position == Vector3.Zero) // Teleport | 5888 | if (position == Vector3.Zero) // Teleport |
5524 | { | 5889 | { |
5525 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5890 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5548,13 +5913,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5548 | } | 5913 | } |
5549 | } | 5914 | } |
5550 | } | 5915 | } |
5916 | |||
5917 | float posX = 128.0f; | ||
5918 | float posY = 128.0f; | ||
5919 | |||
5920 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5921 | { | ||
5922 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5923 | return false; | ||
5924 | } | ||
5925 | } | ||
5926 | else // Walking | ||
5927 | { | ||
5928 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5929 | if (land == null) | ||
5930 | return false; | ||
5931 | |||
5932 | bool banned = land.IsBannedFromLand(agentID); | ||
5933 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5934 | |||
5935 | if (banned || restricted) | ||
5936 | return false; | ||
5551 | } | 5937 | } |
5552 | 5938 | ||
5553 | reason = String.Empty; | 5939 | reason = String.Empty; |
5554 | return true; | 5940 | return true; |
5555 | } | 5941 | } |
5556 | 5942 | ||
5557 | /// <summary> | 5943 | public void StartTimerWatchdog() |
5944 | { | ||
5945 | m_timerWatchdog.Interval = 1000; | ||
5946 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5947 | m_timerWatchdog.AutoReset = true; | ||
5948 | m_timerWatchdog.Start(); | ||
5949 | } | ||
5950 | |||
5951 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5952 | { | ||
5953 | CheckHeartbeat(); | ||
5954 | } | ||
5955 | |||
5558 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5956 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5559 | /// autopilot that moves an avatar to a sit target!. | 5957 | /// autopilot that moves an avatar to a sit target!. |
5560 | /// </summary> | 5958 | /// </summary> |
@@ -5633,6 +6031,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5633 | return m_SpawnPoint - 1; | 6031 | return m_SpawnPoint - 1; |
5634 | } | 6032 | } |
5635 | 6033 | ||
6034 | private void HandleGcCollect(string module, string[] args) | ||
6035 | { | ||
6036 | GC.Collect(); | ||
6037 | } | ||
6038 | |||
5636 | // Wrappers to get physics modules retrieve assets. Has to be done this way | 6039 | // Wrappers to get physics modules retrieve assets. Has to be done this way |
5637 | // because we can't assign the asset service to physics directly - at the | 6040 | // because we can't assign the asset service to physics directly - at the |
5638 | // time physics are instantiated it's not registered but it will be by | 6041 | // time physics are instantiated it's not registered but it will be by |