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 db45d6b..80d9f6e 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) |
@@ -1300,9 +1333,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1300 | // Stop all client threads. | 1333 | // Stop all client threads. |
1301 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1334 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1302 | 1335 | ||
1303 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1336 | m_log.Debug("[SCENE]: TriggerSceneShuttingDown"); |
1304 | EventManager.TriggerSceneShuttingDown(this); | 1337 | EventManager.TriggerSceneShuttingDown(this); |
1305 | 1338 | ||
1339 | m_log.Debug("[SCENE]: Persisting changed objects"); | ||
1340 | |||
1306 | EntityBase[] entities = GetEntities(); | 1341 | EntityBase[] entities = GetEntities(); |
1307 | foreach (EntityBase entity in entities) | 1342 | foreach (EntityBase entity in entities) |
1308 | { | 1343 | { |
@@ -1312,6 +1347,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1312 | } | 1347 | } |
1313 | } | 1348 | } |
1314 | 1349 | ||
1350 | m_log.Debug("[SCENE]: Graph close"); | ||
1315 | m_sceneGraph.Close(); | 1351 | m_sceneGraph.Close(); |
1316 | 1352 | ||
1317 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) | 1353 | if (!GridService.DeregisterRegion(RegionInfo.RegionID)) |
@@ -1324,6 +1360,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1324 | // attempt to reference a null or disposed physics scene. | 1360 | // attempt to reference a null or disposed physics scene. |
1325 | if (PhysicsScene != null) | 1361 | if (PhysicsScene != null) |
1326 | { | 1362 | { |
1363 | m_log.Debug("[SCENE]: Dispose Physics"); | ||
1327 | PhysicsScene phys = PhysicsScene; | 1364 | PhysicsScene phys = PhysicsScene; |
1328 | // remove the physics engine from both Scene and SceneGraph | 1365 | // remove the physics engine from both Scene and SceneGraph |
1329 | PhysicsScene = null; | 1366 | PhysicsScene = null; |
@@ -1346,11 +1383,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1346 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1383 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1347 | if (m_heartbeatThread != null) | 1384 | if (m_heartbeatThread != null) |
1348 | { | 1385 | { |
1386 | m_hbRestarts++; | ||
1387 | if(m_hbRestarts > 10) | ||
1388 | Environment.Exit(1); | ||
1389 | m_log.ErrorFormat("[SCENE]: Restarting heartbeat thread because it hasn't reported in in region {0}", RegionInfo.RegionName); | ||
1390 | |||
1391 | //int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
1392 | //System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
1393 | //proc.EnableRaisingEvents=false; | ||
1394 | //proc.StartInfo.FileName = "/bin/kill"; | ||
1395 | //proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
1396 | //proc.Start(); | ||
1397 | //proc.WaitForExit(); | ||
1398 | //Thread.Sleep(1000); | ||
1399 | //Environment.Exit(1); | ||
1349 | m_heartbeatThread.Abort(); | 1400 | m_heartbeatThread.Abort(); |
1401 | Watchdog.AbortThread(m_heartbeatThread.ManagedThreadId); | ||
1350 | m_heartbeatThread = null; | 1402 | m_heartbeatThread = null; |
1351 | } | 1403 | } |
1352 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1404 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1353 | 1405 | ||
1406 | // m_sceneGraph.PreparePhysicsSimulation(); | ||
1407 | |||
1408 | |||
1354 | m_heartbeatThread | 1409 | m_heartbeatThread |
1355 | = Watchdog.StartThread( | 1410 | = Watchdog.StartThread( |
1356 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1411 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
@@ -1493,16 +1548,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1493 | endFrame = Frame + frames; | 1548 | endFrame = Frame + frames; |
1494 | 1549 | ||
1495 | float physicsFPS = 0f; | 1550 | float physicsFPS = 0f; |
1496 | int previousFrameTick, tmpMS; | 1551 | int tmpMS; |
1497 | int maintc = Util.EnvironmentTickCount(); | 1552 | int previousFrameTick; |
1553 | int maintc; | ||
1554 | int sleepMS; | ||
1555 | int framestart; | ||
1498 | 1556 | ||
1499 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1557 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1500 | { | 1558 | { |
1559 | framestart = Util.EnvironmentTickCount(); | ||
1501 | ++Frame; | 1560 | ++Frame; |
1502 | 1561 | ||
1503 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1562 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1504 | 1563 | ||
1505 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; | 1564 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1506 | 1565 | ||
1507 | try | 1566 | try |
1508 | { | 1567 | { |
@@ -1554,6 +1613,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1554 | m_sceneGraph.UpdatePresences(); | 1613 | m_sceneGraph.UpdatePresences(); |
1555 | 1614 | ||
1556 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1615 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); |
1616 | |||
1557 | 1617 | ||
1558 | // Delete temp-on-rez stuff | 1618 | // Delete temp-on-rez stuff |
1559 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1619 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
@@ -1635,34 +1695,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1635 | 1695 | ||
1636 | Watchdog.UpdateThread(); | 1696 | Watchdog.UpdateThread(); |
1637 | 1697 | ||
1698 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1699 | |||
1700 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1701 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1702 | StatsReporter.AddFPS(1); | ||
1703 | |||
1704 | StatsReporter.addAgentMS(agentMS); | ||
1705 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1706 | StatsReporter.addOtherMS(otherMS); | ||
1707 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1708 | |||
1638 | previousFrameTick = m_lastFrameTick; | 1709 | previousFrameTick = m_lastFrameTick; |
1639 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1710 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1640 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1711 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); |
1641 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1712 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1642 | 1713 | ||
1714 | m_firstHeartbeat = false; | ||
1715 | |||
1716 | sleepMS = Util.EnvironmentTickCount(); | ||
1717 | |||
1643 | if (tmpMS > 0) | 1718 | if (tmpMS > 0) |
1644 | { | ||
1645 | Thread.Sleep(tmpMS); | 1719 | Thread.Sleep(tmpMS); |
1646 | spareMS += tmpMS; | ||
1647 | } | ||
1648 | 1720 | ||
1649 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | 1721 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); |
1650 | maintc = Util.EnvironmentTickCount(); | 1722 | frameMS = Util.EnvironmentTickCountSubtract(framestart); |
1651 | 1723 | StatsReporter.addSleepMS(sleepMS); | |
1652 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1724 | StatsReporter.addFrameMS(frameMS); |
1653 | 1725 | ||
1654 | // if (Frame%m_update_avatars == 0) | 1726 | // if (Frame%m_update_avatars == 0) |
1655 | // UpdateInWorldTime(); | 1727 | // UpdateInWorldTime(); |
1656 | StatsReporter.AddPhysicsFPS(physicsFPS); | ||
1657 | StatsReporter.AddTimeDilation(TimeDilation); | ||
1658 | StatsReporter.AddFPS(1); | ||
1659 | 1728 | ||
1660 | StatsReporter.addFrameMS(frameMS); | ||
1661 | StatsReporter.addAgentMS(agentMS); | ||
1662 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | ||
1663 | StatsReporter.addOtherMS(otherMS); | ||
1664 | StatsReporter.AddSpareMS(spareMS); | ||
1665 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | ||
1666 | 1729 | ||
1667 | // Optionally warn if a frame takes double the amount of time that it should. | 1730 | // Optionally warn if a frame takes double the amount of time that it should. |
1668 | if (DebugUpdates | 1731 | if (DebugUpdates |
@@ -1780,7 +1843,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1780 | msg.fromAgentName = "Server"; | 1843 | msg.fromAgentName = "Server"; |
1781 | msg.dialog = (byte)19; // Object msg | 1844 | msg.dialog = (byte)19; // Object msg |
1782 | msg.fromGroup = false; | 1845 | msg.fromGroup = false; |
1783 | msg.offline = (byte)0; | 1846 | msg.offline = (byte)1; |
1784 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; | 1847 | msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID; |
1785 | msg.Position = Vector3.Zero; | 1848 | msg.Position = Vector3.Zero; |
1786 | msg.RegionID = RegionInfo.RegionID.Guid; | 1849 | msg.RegionID = RegionInfo.RegionID.Guid; |
@@ -2002,6 +2065,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2002 | EventManager.TriggerPrimsLoaded(this); | 2065 | EventManager.TriggerPrimsLoaded(this); |
2003 | } | 2066 | } |
2004 | 2067 | ||
2068 | public bool SuportsRayCastFiltered() | ||
2069 | { | ||
2070 | if (PhysicsScene == null) | ||
2071 | return false; | ||
2072 | return PhysicsScene.SuportsRaycastWorldFiltered(); | ||
2073 | } | ||
2074 | |||
2075 | public object RayCastFiltered(Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags filter) | ||
2076 | { | ||
2077 | if (PhysicsScene == null) | ||
2078 | return null; | ||
2079 | return PhysicsScene.RaycastWorld(position, direction, length, Count,filter); | ||
2080 | } | ||
2005 | 2081 | ||
2006 | /// <summary> | 2082 | /// <summary> |
2007 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. | 2083 | /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. |
@@ -2018,14 +2094,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2018 | /// <returns></returns> | 2094 | /// <returns></returns> |
2019 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) | 2095 | public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) |
2020 | { | 2096 | { |
2097 | |||
2098 | float wheight = (float)RegionInfo.RegionSettings.WaterHeight; | ||
2099 | Vector3 wpos = Vector3.Zero; | ||
2100 | // Check for water surface intersection from above | ||
2101 | if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) ) | ||
2102 | { | ||
2103 | float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); | ||
2104 | wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); | ||
2105 | wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); | ||
2106 | wpos.Z = wheight; | ||
2107 | } | ||
2108 | |||
2021 | Vector3 pos = Vector3.Zero; | 2109 | Vector3 pos = Vector3.Zero; |
2022 | if (RayEndIsIntersection == (byte)1) | 2110 | if (RayEndIsIntersection == (byte)1) |
2023 | { | 2111 | { |
2024 | pos = RayEnd; | 2112 | pos = RayEnd; |
2025 | return pos; | ||
2026 | } | 2113 | } |
2027 | 2114 | else if (RayTargetID != UUID.Zero) | |
2028 | if (RayTargetID != UUID.Zero) | ||
2029 | { | 2115 | { |
2030 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2116 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2031 | 2117 | ||
@@ -2047,7 +2133,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2047 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2133 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2048 | 2134 | ||
2049 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2135 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2050 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2136 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2051 | float ScaleOffset = 0.5f; | 2137 | float ScaleOffset = 0.5f; |
2052 | 2138 | ||
2053 | // If we hit something | 2139 | // If we hit something |
@@ -2070,13 +2156,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2070 | //pos.Z -= 0.25F; | 2156 | //pos.Z -= 0.25F; |
2071 | 2157 | ||
2072 | } | 2158 | } |
2073 | |||
2074 | return pos; | ||
2075 | } | 2159 | } |
2076 | else | 2160 | else |
2077 | { | 2161 | { |
2078 | // We don't have a target here, so we're going to raytrace all the objects in the scene. | 2162 | // We don't have a target here, so we're going to raytrace all the objects in the scene. |
2079 | |||
2080 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); | 2163 | EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); |
2081 | 2164 | ||
2082 | // Un-comment the following line to print the raytrace results to the console. | 2165 | // Un-comment the following line to print the raytrace results to the console. |
@@ -2085,13 +2168,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2085 | if (ei.HitTF) | 2168 | if (ei.HitTF) |
2086 | { | 2169 | { |
2087 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2170 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); |
2088 | } else | 2171 | } |
2172 | else | ||
2089 | { | 2173 | { |
2090 | // fall back to our stupid functionality | 2174 | // fall back to our stupid functionality |
2091 | pos = RayEnd; | 2175 | pos = RayEnd; |
2092 | } | 2176 | } |
2093 | |||
2094 | return pos; | ||
2095 | } | 2177 | } |
2096 | } | 2178 | } |
2097 | else | 2179 | else |
@@ -2102,8 +2184,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2102 | //increase height so its above the ground. | 2184 | //increase height so its above the ground. |
2103 | //should be getting the normal of the ground at the rez point and using that? | 2185 | //should be getting the normal of the ground at the rez point and using that? |
2104 | pos.Z += scale.Z / 2f; | 2186 | pos.Z += scale.Z / 2f; |
2105 | return pos; | 2187 | // return pos; |
2106 | } | 2188 | } |
2189 | |||
2190 | // check against posible water intercept | ||
2191 | if (wpos.Z > pos.Z) pos = wpos; | ||
2192 | return pos; | ||
2107 | } | 2193 | } |
2108 | 2194 | ||
2109 | 2195 | ||
@@ -2194,12 +2280,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2194 | { | 2280 | { |
2195 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) | 2281 | if (m_sceneGraph.AddRestoredSceneObject(sceneObject, attachToBackup, alreadyPersisted, sendClientUpdates)) |
2196 | { | 2282 | { |
2283 | sceneObject.IsDeleted = false; | ||
2197 | EventManager.TriggerObjectAddedToScene(sceneObject); | 2284 | EventManager.TriggerObjectAddedToScene(sceneObject); |
2198 | return true; | 2285 | return true; |
2199 | } | 2286 | } |
2200 | 2287 | ||
2201 | return false; | 2288 | return false; |
2202 | |||
2203 | } | 2289 | } |
2204 | 2290 | ||
2205 | /// <summary> | 2291 | /// <summary> |
@@ -2291,6 +2377,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2291 | /// </summary> | 2377 | /// </summary> |
2292 | public void DeleteAllSceneObjects() | 2378 | public void DeleteAllSceneObjects() |
2293 | { | 2379 | { |
2380 | DeleteAllSceneObjects(false); | ||
2381 | } | ||
2382 | |||
2383 | /// <summary> | ||
2384 | /// Delete every object from the scene. This does not include attachments worn by avatars. | ||
2385 | /// </summary> | ||
2386 | public void DeleteAllSceneObjects(bool exceptNoCopy) | ||
2387 | { | ||
2388 | List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); | ||
2294 | lock (Entities) | 2389 | lock (Entities) |
2295 | { | 2390 | { |
2296 | EntityBase[] entities = Entities.GetEntities(); | 2391 | EntityBase[] entities = Entities.GetEntities(); |
@@ -2299,11 +2394,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2299 | if (e is SceneObjectGroup) | 2394 | if (e is SceneObjectGroup) |
2300 | { | 2395 | { |
2301 | SceneObjectGroup sog = (SceneObjectGroup)e; | 2396 | SceneObjectGroup sog = (SceneObjectGroup)e; |
2302 | if (!sog.IsAttachment) | 2397 | if (sog != null && !sog.IsAttachment) |
2303 | DeleteSceneObject((SceneObjectGroup)e, false); | 2398 | { |
2399 | if (!exceptNoCopy || ((sog.GetEffectivePermissions() & (uint)PermissionMask.Copy) != 0)) | ||
2400 | { | ||
2401 | DeleteSceneObject((SceneObjectGroup)e, false); | ||
2402 | } | ||
2403 | else | ||
2404 | { | ||
2405 | toReturn.Add((SceneObjectGroup)e); | ||
2406 | } | ||
2407 | } | ||
2304 | } | 2408 | } |
2305 | } | 2409 | } |
2306 | } | 2410 | } |
2411 | if (toReturn.Count > 0) | ||
2412 | { | ||
2413 | returnObjects(toReturn.ToArray(), UUID.Zero); | ||
2414 | } | ||
2307 | } | 2415 | } |
2308 | 2416 | ||
2309 | /// <summary> | 2417 | /// <summary> |
@@ -2338,6 +2446,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2338 | 2446 | ||
2339 | foreach (SceneObjectPart part in partList) | 2447 | foreach (SceneObjectPart part in partList) |
2340 | { | 2448 | { |
2449 | if (part.KeyframeMotion != null) | ||
2450 | { | ||
2451 | part.KeyframeMotion.Delete(); | ||
2452 | part.KeyframeMotion = null; | ||
2453 | } | ||
2454 | |||
2341 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2455 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2342 | { | 2456 | { |
2343 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2457 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
@@ -2355,6 +2469,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2355 | } | 2469 | } |
2356 | 2470 | ||
2357 | group.DeleteGroupFromScene(silent); | 2471 | group.DeleteGroupFromScene(silent); |
2472 | if (!silent) | ||
2473 | SendKillObject(new List<uint>() { group.LocalId }); | ||
2358 | 2474 | ||
2359 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); | 2475 | // m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); |
2360 | } | 2476 | } |
@@ -2645,7 +2761,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2645 | // If the user is banned, we won't let any of their objects | 2761 | // If the user is banned, we won't let any of their objects |
2646 | // enter. Period. | 2762 | // enter. Period. |
2647 | // | 2763 | // |
2648 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | 2764 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID, 36)) |
2649 | { | 2765 | { |
2650 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | 2766 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); |
2651 | return false; | 2767 | return false; |
@@ -2653,6 +2769,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2653 | 2769 | ||
2654 | if (newPosition != Vector3.Zero) | 2770 | if (newPosition != Vector3.Zero) |
2655 | newObject.RootPart.GroupPosition = newPosition; | 2771 | newObject.RootPart.GroupPosition = newPosition; |
2772 | if (newObject.RootPart.KeyframeMotion != null) | ||
2773 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2656 | 2774 | ||
2657 | if (!AddSceneObject(newObject)) | 2775 | if (!AddSceneObject(newObject)) |
2658 | { | 2776 | { |
@@ -2697,6 +2815,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2697 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> | 2815 | /// <returns>True if the SceneObjectGroup was added, False if it was not</returns> |
2698 | public bool AddSceneObject(SceneObjectGroup sceneObject) | 2816 | public bool AddSceneObject(SceneObjectGroup sceneObject) |
2699 | { | 2817 | { |
2818 | if (sceneObject.OwnerID == UUID.Zero) | ||
2819 | { | ||
2820 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero", sceneObject.UUID); | ||
2821 | return false; | ||
2822 | } | ||
2823 | |||
2824 | // If the user is banned, we won't let any of their objects | ||
2825 | // enter. Period. | ||
2826 | // | ||
2827 | int flags = GetUserFlags(sceneObject.OwnerID); | ||
2828 | if (RegionInfo.EstateSettings.IsBanned(sceneObject.OwnerID, flags)) | ||
2829 | { | ||
2830 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", sceneObject.OwnerID); | ||
2831 | |||
2832 | return false; | ||
2833 | } | ||
2834 | |||
2700 | // Force allocation of new LocalId | 2835 | // Force allocation of new LocalId |
2701 | // | 2836 | // |
2702 | SceneObjectPart[] parts = sceneObject.Parts; | 2837 | SceneObjectPart[] parts = sceneObject.Parts; |
@@ -2730,16 +2865,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
2730 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2865 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2731 | 2866 | ||
2732 | if (AttachmentsModule != null) | 2867 | if (AttachmentsModule != null) |
2733 | AttachmentsModule.AttachObject(sp, grp, 0, false, false); | 2868 | AttachmentsModule.AttachObject(sp, grp, 0, false, false, false); |
2734 | } | 2869 | } |
2735 | else | 2870 | else |
2736 | { | 2871 | { |
2872 | m_log.DebugFormat("[SCENE]: Attachment {0} arrived and scene presence was not found, setting to temp", sceneObject.UUID); | ||
2737 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2873 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2738 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); | 2874 | RootPrim.AddFlag(PrimFlags.TemporaryOnRez); |
2739 | } | 2875 | } |
2876 | if (sceneObject.OwnerID == UUID.Zero) | ||
2877 | { | ||
2878 | m_log.ErrorFormat("[SCENE]: Owner ID for {0} was zero after attachment processing. BUG!", sceneObject.UUID); | ||
2879 | return false; | ||
2880 | } | ||
2740 | } | 2881 | } |
2741 | else | 2882 | else |
2742 | { | 2883 | { |
2884 | if (sceneObject.OwnerID == UUID.Zero) | ||
2885 | { | ||
2886 | m_log.ErrorFormat("[SCENE]: Owner ID for non-attachment {0} was zero", sceneObject.UUID); | ||
2887 | return false; | ||
2888 | } | ||
2743 | AddRestoredSceneObject(sceneObject, true, false); | 2889 | AddRestoredSceneObject(sceneObject, true, false); |
2744 | } | 2890 | } |
2745 | 2891 | ||
@@ -2756,6 +2902,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2756 | return 2; // StateSource.PrimCrossing | 2902 | return 2; // StateSource.PrimCrossing |
2757 | } | 2903 | } |
2758 | 2904 | ||
2905 | public int GetUserFlags(UUID user) | ||
2906 | { | ||
2907 | //Unfortunately the SP approach means that the value is cached until region is restarted | ||
2908 | /* | ||
2909 | ScenePresence sp; | ||
2910 | if (TryGetScenePresence(user, out sp)) | ||
2911 | { | ||
2912 | return sp.UserFlags; | ||
2913 | } | ||
2914 | else | ||
2915 | { | ||
2916 | */ | ||
2917 | UserAccount uac = UserAccountService.GetUserAccount(RegionInfo.ScopeID, user); | ||
2918 | if (uac == null) | ||
2919 | return 0; | ||
2920 | return uac.UserFlags; | ||
2921 | //} | ||
2922 | } | ||
2759 | #endregion | 2923 | #endregion |
2760 | 2924 | ||
2761 | #region Add/Remove Avatar Methods | 2925 | #region Add/Remove Avatar Methods |
@@ -2788,7 +2952,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2788 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 | 2952 | = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 |
2789 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; | 2953 | || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; |
2790 | 2954 | ||
2791 | // CheckHeartbeat(); | 2955 | CheckHeartbeat(); |
2792 | 2956 | ||
2793 | sp = GetScenePresence(client.AgentId); | 2957 | sp = GetScenePresence(client.AgentId); |
2794 | 2958 | ||
@@ -2932,19 +3096,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2932 | // and the scene presence and the client, if they exist | 3096 | // and the scene presence and the client, if they exist |
2933 | try | 3097 | try |
2934 | { | 3098 | { |
2935 | // We need to wait for the client to make UDP contact first. | 3099 | ScenePresence sp = GetScenePresence(agentID); |
2936 | // It's the UDP contact that creates the scene presence | 3100 | |
2937 | ScenePresence sp = WaitGetScenePresence(agentID); | ||
2938 | if (sp != null) | 3101 | if (sp != null) |
2939 | { | 3102 | { |
2940 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); | 3103 | PresenceService.LogoutAgent(sp.ControllingClient.SessionId); |
2941 | |||
2942 | sp.ControllingClient.Close(); | 3104 | sp.ControllingClient.Close(); |
2943 | } | 3105 | } |
2944 | else | 3106 | |
2945 | { | ||
2946 | m_log.WarnFormat("[SCENE]: Could not find scene presence for {0}", agentID); | ||
2947 | } | ||
2948 | // BANG! SLASH! | 3107 | // BANG! SLASH! |
2949 | m_authenticateHandler.RemoveCircuit(agentID); | 3108 | m_authenticateHandler.RemoveCircuit(agentID); |
2950 | 3109 | ||
@@ -2989,6 +3148,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2989 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; | 3148 | client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimGroupPosition; |
2990 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; | 3149 | client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; |
2991 | 3150 | ||
3151 | client.onClientChangeObject += m_sceneGraph.ClientChangeObject; | ||
3152 | |||
2992 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3153 | client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2993 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; | 3154 | client.OnUpdatePrimGroupMouseRotation += m_sceneGraph.UpdatePrimGroupRotation; |
2994 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; | 3155 | client.OnUpdatePrimSingleRotation += m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3045,6 +3206,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3045 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; | 3206 | client.OnFetchInventory += m_asyncInventorySender.HandleFetchInventory; |
3046 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 3207 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
3047 | client.OnCopyInventoryItem += CopyInventoryItem; | 3208 | client.OnCopyInventoryItem += CopyInventoryItem; |
3209 | client.OnMoveItemsAndLeaveCopy += MoveInventoryItemsLeaveCopy; | ||
3048 | client.OnMoveInventoryItem += MoveInventoryItem; | 3210 | client.OnMoveInventoryItem += MoveInventoryItem; |
3049 | client.OnRemoveInventoryItem += RemoveInventoryItem; | 3211 | client.OnRemoveInventoryItem += RemoveInventoryItem; |
3050 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; | 3212 | client.OnRemoveInventoryFolder += RemoveInventoryFolder; |
@@ -3116,6 +3278,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3116 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; | 3278 | client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimGroupPosition; |
3117 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; | 3279 | client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; |
3118 | 3280 | ||
3281 | client.onClientChangeObject -= m_sceneGraph.ClientChangeObject; | ||
3282 | |||
3119 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3283 | client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3120 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; | 3284 | client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimGroupRotation; |
3121 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; | 3285 | client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; |
@@ -3218,7 +3382,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3218 | /// </summary> | 3382 | /// </summary> |
3219 | /// <param name="agentId">The avatar's Unique ID</param> | 3383 | /// <param name="agentId">The avatar's Unique ID</param> |
3220 | /// <param name="client">The IClientAPI for the client</param> | 3384 | /// <param name="client">The IClientAPI for the client</param> |
3221 | public virtual void TeleportClientHome(UUID agentId, IClientAPI client) | 3385 | public virtual bool TeleportClientHome(UUID agentId, IClientAPI client) |
3222 | { | 3386 | { |
3223 | if (EntityTransferModule != null) | 3387 | if (EntityTransferModule != null) |
3224 | { | 3388 | { |
@@ -3229,6 +3393,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3229 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); | 3393 | m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active"); |
3230 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); | 3394 | client.SendTeleportFailed("Unable to perform teleports on this simulator."); |
3231 | } | 3395 | } |
3396 | return false; | ||
3232 | } | 3397 | } |
3233 | 3398 | ||
3234 | /// <summary> | 3399 | /// <summary> |
@@ -3338,6 +3503,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
3338 | /// <param name="flags"></param> | 3503 | /// <param name="flags"></param> |
3339 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) | 3504 | public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) |
3340 | { | 3505 | { |
3506 | //Add half the avatar's height so that the user doesn't fall through prims | ||
3507 | ScenePresence presence; | ||
3508 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | ||
3509 | { | ||
3510 | if (presence.Appearance != null) | ||
3511 | { | ||
3512 | position.Z = position.Z + (presence.Appearance.AvatarHeight / 2); | ||
3513 | } | ||
3514 | } | ||
3515 | |||
3341 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) | 3516 | if (GridUserService != null && GridUserService.SetHome(remoteClient.AgentId.ToString(), RegionInfo.RegionID, position, lookAt)) |
3342 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 3517 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
3343 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); | 3518 | m_dialogModule.SendAlertToUser(remoteClient, "Home position set."); |
@@ -3475,6 +3650,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3475 | // It's possible for child agents to have transactions if changes are being made cross-border. | 3650 | // It's possible for child agents to have transactions if changes are being made cross-border. |
3476 | if (AgentTransactionsModule != null) | 3651 | if (AgentTransactionsModule != null) |
3477 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); | 3652 | AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); |
3653 | m_log.Debug("[Scene] The avatar has left the building"); | ||
3478 | } | 3654 | } |
3479 | catch (Exception e) | 3655 | catch (Exception e) |
3480 | { | 3656 | { |
@@ -3667,38 +3843,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
3667 | agent.firstname, agent.lastname, agent.Viewer); | 3843 | agent.firstname, agent.lastname, agent.Viewer); |
3668 | reason = "Access denied, your viewer is banned by the region owner"; | 3844 | reason = "Access denied, your viewer is banned by the region owner"; |
3669 | return false; | 3845 | return false; |
3670 | } | 3846 | } |
3847 | |||
3848 | |||
3849 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3671 | 3850 | ||
3672 | ILandObject land; | 3851 | if (sp != null && !sp.IsChildAgent) |
3852 | { | ||
3853 | // We have a zombie from a crashed session. | ||
3854 | // Or the same user is trying to be root twice here, won't work. | ||
3855 | // Kill it. | ||
3856 | m_log.WarnFormat( | ||
3857 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3858 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3859 | |||
3860 | sp.ControllingClient.Close(true, true); | ||
3861 | sp = null; | ||
3862 | } | ||
3673 | 3863 | ||
3674 | lock (agent) | 3864 | lock (agent) |
3675 | { | 3865 | { |
3676 | ScenePresence sp = GetScenePresence(agent.AgentID); | ||
3677 | |||
3678 | if (sp != null && !sp.IsChildAgent) | ||
3679 | { | ||
3680 | // We have a zombie from a crashed session. | ||
3681 | // Or the same user is trying to be root twice here, won't work. | ||
3682 | // Kill it. | ||
3683 | m_log.WarnFormat( | ||
3684 | "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", | ||
3685 | sp.Name, sp.UUID, RegionInfo.RegionName); | ||
3686 | |||
3687 | sp.ControllingClient.Close(true); | ||
3688 | sp = null; | ||
3689 | } | ||
3690 | |||
3691 | land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3692 | |||
3693 | //On login test land permisions | 3866 | //On login test land permisions |
3694 | if (vialogin) | 3867 | if (vialogin) |
3695 | { | 3868 | { |
3696 | if (land != null && !TestLandRestrictions(agent, land, out reason)) | 3869 | IUserAccountCacheModule cache = RequestModuleInterface<IUserAccountCacheModule>(); |
3870 | if (cache != null) | ||
3871 | cache.Remove(agent.firstname + " " + agent.lastname); | ||
3872 | if (!TestLandRestrictions(agent.AgentID, out reason, ref agent.startpos.X, ref agent.startpos.Y)) | ||
3697 | { | 3873 | { |
3874 | m_log.DebugFormat("[CONNECTION BEGIN]: Denying access to {0} due to no land access", agent.AgentID.ToString()); | ||
3698 | return false; | 3875 | return false; |
3699 | } | 3876 | } |
3700 | } | 3877 | } |
3701 | 3878 | ||
3702 | if (sp == null) // We don't have an [child] agent here already | 3879 | if (sp == null) // We don't have an [child] agent here already |
3703 | { | 3880 | { |
3704 | if (requirePresenceLookup) | 3881 | if (requirePresenceLookup) |
@@ -3707,34 +3884,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3707 | { | 3884 | { |
3708 | if (!VerifyUserPresence(agent, out reason)) | 3885 | if (!VerifyUserPresence(agent, out reason)) |
3709 | return false; | 3886 | return false; |
3710 | } | 3887 | } catch (Exception e) |
3711 | catch (Exception e) | ||
3712 | { | 3888 | { |
3713 | m_log.ErrorFormat( | 3889 | m_log.ErrorFormat( |
3714 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); | 3890 | "[SCENE]: Exception verifying presence {0}{1}", e.Message, e.StackTrace); |
3715 | |||
3716 | return false; | 3891 | return false; |
3717 | } | 3892 | } |
3718 | } | 3893 | } |
3719 | 3894 | ||
3720 | try | 3895 | try |
3721 | { | 3896 | { |
3722 | if (!AuthorizeUser(agent, out reason)) | 3897 | // Always check estate if this is a login. Always |
3723 | return false; | 3898 | // check if banned regions are to be blacked out. |
3899 | if (vialogin || (!m_seeIntoBannedRegion)) | ||
3900 | { | ||
3901 | if (!AuthorizeUser(agent, out reason)) | ||
3902 | return false; | ||
3903 | } | ||
3724 | } | 3904 | } |
3725 | catch (Exception e) | 3905 | catch (Exception e) |
3726 | { | 3906 | { |
3727 | m_log.ErrorFormat( | 3907 | m_log.ErrorFormat( |
3728 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); | 3908 | "[SCENE]: Exception authorizing user {0}{1}", e.Message, e.StackTrace); |
3729 | |||
3730 | return false; | 3909 | return false; |
3731 | } | 3910 | } |
3732 | 3911 | ||
3733 | m_log.InfoFormat( | 3912 | m_log.InfoFormat( |
3734 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", | 3913 | "[SCENE]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", |
3735 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, | 3914 | RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, |
3736 | agent.AgentID, agent.circuitcode); | 3915 | agent.AgentID, agent.circuitcode); |
3737 | 3916 | ||
3738 | if (CapsModule != null) | 3917 | if (CapsModule != null) |
3739 | { | 3918 | { |
3740 | CapsModule.SetAgentCapsSeeds(agent); | 3919 | CapsModule.SetAgentCapsSeeds(agent); |
@@ -3746,15 +3925,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3746 | // Let the SP know how we got here. This has a lot of interesting | 3925 | // Let the SP know how we got here. This has a lot of interesting |
3747 | // uses down the line. | 3926 | // uses down the line. |
3748 | sp.TeleportFlags = (TPFlags)teleportFlags; | 3927 | sp.TeleportFlags = (TPFlags)teleportFlags; |
3749 | 3928 | ||
3750 | if (sp.IsChildAgent) | 3929 | if (sp.IsChildAgent) |
3751 | { | 3930 | { |
3752 | m_log.DebugFormat( | 3931 | m_log.DebugFormat( |
3753 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", | 3932 | "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", |
3754 | agent.AgentID, RegionInfo.RegionName); | 3933 | agent.AgentID, RegionInfo.RegionName); |
3755 | 3934 | ||
3756 | sp.AdjustKnownSeeds(); | 3935 | sp.AdjustKnownSeeds(); |
3757 | 3936 | ||
3758 | if (CapsModule != null) | 3937 | if (CapsModule != null) |
3759 | CapsModule.SetAgentCapsSeeds(agent); | 3938 | CapsModule.SetAgentCapsSeeds(agent); |
3760 | } | 3939 | } |
@@ -3856,6 +4035,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3856 | } | 4035 | } |
3857 | 4036 | ||
3858 | // Honor parcel landing type and position. | 4037 | // Honor parcel landing type and position. |
4038 | /* | ||
4039 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | ||
3859 | if (land != null) | 4040 | if (land != null) |
3860 | { | 4041 | { |
3861 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) | 4042 | if (land.LandData.LandingType == (byte)1 && land.LandData.UserLocation != Vector3.Zero) |
@@ -3863,25 +4044,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3863 | agent.startpos = land.LandData.UserLocation; | 4044 | agent.startpos = land.LandData.UserLocation; |
3864 | } | 4045 | } |
3865 | } | 4046 | } |
4047 | */// This is now handled properly in ScenePresence.MakeRootAgent | ||
3866 | } | 4048 | } |
3867 | 4049 | ||
3868 | return true; | 4050 | return true; |
3869 | } | 4051 | } |
3870 | 4052 | ||
3871 | private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason) | 4053 | public bool TestLandRestrictions(UUID agentID, out string reason, ref float posX, ref float posY) |
3872 | { | 4054 | { |
3873 | bool banned = land.IsBannedFromLand(agent.AgentID); | 4055 | if (posX < 0) |
3874 | bool restricted = land.IsRestrictedFromLand(agent.AgentID); | 4056 | posX = 0; |
4057 | else if (posX >= 256) | ||
4058 | posX = 255.999f; | ||
4059 | if (posY < 0) | ||
4060 | posY = 0; | ||
4061 | else if (posY >= 256) | ||
4062 | posY = 255.999f; | ||
4063 | |||
4064 | reason = String.Empty; | ||
4065 | if (Permissions.IsGod(agentID)) | ||
4066 | return true; | ||
4067 | |||
4068 | ILandObject land = LandChannel.GetLandObject(posX, posY); | ||
4069 | if (land == null) | ||
4070 | return false; | ||
4071 | |||
4072 | bool banned = land.IsBannedFromLand(agentID); | ||
4073 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
3875 | 4074 | ||
3876 | if (banned || restricted) | 4075 | if (banned || restricted) |
3877 | { | 4076 | { |
3878 | ILandObject nearestParcel = GetNearestAllowedParcel(agent.AgentID, agent.startpos.X, agent.startpos.Y); | 4077 | ILandObject nearestParcel = GetNearestAllowedParcel(agentID, posX, posY); |
3879 | if (nearestParcel != null) | 4078 | if (nearestParcel != null) |
3880 | { | 4079 | { |
3881 | //Move agent to nearest allowed | 4080 | //Move agent to nearest allowed |
3882 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); | 4081 | Vector3 newPosition = GetParcelCenterAtGround(nearestParcel); |
3883 | agent.startpos.X = newPosition.X; | 4082 | posX = newPosition.X; |
3884 | agent.startpos.Y = newPosition.Y; | 4083 | posY = newPosition.Y; |
3885 | } | 4084 | } |
3886 | else | 4085 | else |
3887 | { | 4086 | { |
@@ -3943,7 +4142,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3943 | 4142 | ||
3944 | if (!m_strictAccessControl) return true; | 4143 | if (!m_strictAccessControl) return true; |
3945 | if (Permissions.IsGod(agent.AgentID)) return true; | 4144 | if (Permissions.IsGod(agent.AgentID)) return true; |
3946 | 4145 | ||
3947 | if (AuthorizationService != null) | 4146 | if (AuthorizationService != null) |
3948 | { | 4147 | { |
3949 | if (!AuthorizationService.IsAuthorizedForRegion( | 4148 | if (!AuthorizationService.IsAuthorizedForRegion( |
@@ -3958,7 +4157,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3958 | 4157 | ||
3959 | if (RegionInfo.EstateSettings != null) | 4158 | if (RegionInfo.EstateSettings != null) |
3960 | { | 4159 | { |
3961 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID)) | 4160 | if (RegionInfo.EstateSettings.IsBanned(agent.AgentID, 0)) |
3962 | { | 4161 | { |
3963 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", | 4162 | m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user is on the banlist", |
3964 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); | 4163 | agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); |
@@ -4148,6 +4347,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4148 | 4347 | ||
4149 | // XPTO: if this agent is not allowed here as root, always return false | 4348 | // XPTO: if this agent is not allowed here as root, always return false |
4150 | 4349 | ||
4350 | // We have to wait until the viewer contacts this region after receiving EAC. | ||
4351 | // That calls AddNewClient, which finally creates the ScenePresence | ||
4352 | int flags = GetUserFlags(cAgentData.AgentID); | ||
4353 | if (RegionInfo.EstateSettings.IsBanned(cAgentData.AgentID, flags)) | ||
4354 | { | ||
4355 | m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: banned", cAgentData.AgentID); | ||
4356 | return false; | ||
4357 | } | ||
4358 | |||
4151 | // TODO: This check should probably be in QueryAccess(). | 4359 | // TODO: This check should probably be in QueryAccess(). |
4152 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); | 4360 | ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); |
4153 | if (nearestParcel == null) | 4361 | if (nearestParcel == null) |
@@ -4212,7 +4420,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4212 | /// <param name='agentID'></param> | 4420 | /// <param name='agentID'></param> |
4213 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) | 4421 | protected virtual ScenePresence WaitGetScenePresence(UUID agentID) |
4214 | { | 4422 | { |
4215 | int ntimes = 10; | 4423 | int ntimes = 30; |
4216 | ScenePresence sp = null; | 4424 | ScenePresence sp = null; |
4217 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) | 4425 | while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) |
4218 | Thread.Sleep(1000); | 4426 | Thread.Sleep(1000); |
@@ -4242,6 +4450,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4242 | return false; | 4450 | return false; |
4243 | } | 4451 | } |
4244 | 4452 | ||
4453 | public bool IncomingCloseAgent(UUID agentID) | ||
4454 | { | ||
4455 | return IncomingCloseAgent(agentID, false); | ||
4456 | } | ||
4457 | |||
4458 | public bool IncomingCloseChildAgent(UUID agentID) | ||
4459 | { | ||
4460 | return IncomingCloseAgent(agentID, true); | ||
4461 | } | ||
4462 | |||
4245 | /// <summary> | 4463 | /// <summary> |
4246 | /// Tell a single agent to disconnect from the region. | 4464 | /// Tell a single agent to disconnect from the region. |
4247 | /// </summary> | 4465 | /// </summary> |
@@ -4257,7 +4475,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4257 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4475 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4258 | if (presence != null) | 4476 | if (presence != null) |
4259 | { | 4477 | { |
4260 | presence.ControllingClient.Close(force); | 4478 | presence.ControllingClient.Close(force, force); |
4261 | return true; | 4479 | return true; |
4262 | } | 4480 | } |
4263 | 4481 | ||
@@ -4917,35 +5135,81 @@ namespace OpenSim.Region.Framework.Scenes | |||
4917 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); | 5135 | SimulationDataService.RemoveObject(uuid, RegionInfo.RegionID); |
4918 | } | 5136 | } |
4919 | 5137 | ||
4920 | public int GetHealth() | 5138 | public int GetHealth(out int flags, out string message) |
4921 | { | 5139 | { |
4922 | // Returns: | 5140 | // Returns: |
4923 | // 1 = sim is up and accepting http requests. The heartbeat has | 5141 | // 1 = sim is up and accepting http requests. The heartbeat has |
4924 | // stopped and the sim is probably locked up, but a remote | 5142 | // stopped and the sim is probably locked up, but a remote |
4925 | // admin restart may succeed | 5143 | // admin restart may succeed |
4926 | // | 5144 | // |
4927 | // 2 = Sim is up and the heartbeat is running. The sim is likely | 5145 | // 2 = Sim is up and the heartbeat is running. The sim is likely |
4928 | // usable for people within and logins _may_ work | 5146 | // usable for people within |
5147 | // | ||
5148 | // 3 = Sim is up and one packet thread is running. Sim is | ||
5149 | // unstable and will not accept new logins | ||
4929 | // | 5150 | // |
4930 | // 3 = We have seen a new user enter within the past 4 minutes | 5151 | // 4 = Sim is up and both packet threads are running. Sim is |
5152 | // likely usable | ||
5153 | // | ||
5154 | // 5 = We have seen a new user enter within the past 4 minutes | ||
4931 | // which can be seen as positive confirmation of sim health | 5155 | // which can be seen as positive confirmation of sim health |
4932 | // | 5156 | // |
5157 | |||
5158 | flags = 0; | ||
5159 | message = String.Empty; | ||
5160 | |||
5161 | CheckHeartbeat(); | ||
5162 | |||
5163 | if (m_firstHeartbeat || (m_lastIncoming == 0 && m_lastOutgoing == 0)) | ||
5164 | { | ||
5165 | // We're still starting | ||
5166 | // 0 means "in startup", it can't happen another way, since | ||
5167 | // to get here, we must be able to accept http connections | ||
5168 | return 0; | ||
5169 | } | ||
5170 | |||
4933 | int health=1; // Start at 1, means we're up | 5171 | int health=1; // Start at 1, means we're up |
4934 | 5172 | ||
4935 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) | 5173 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) |
4936 | health += 1; | 5174 | { |
5175 | health+=1; | ||
5176 | flags |= 1; | ||
5177 | } | ||
5178 | |||
5179 | if (Util.EnvironmentTickCountSubtract(m_lastIncoming) < 1000) | ||
5180 | { | ||
5181 | health+=1; | ||
5182 | flags |= 2; | ||
5183 | } | ||
5184 | |||
5185 | if (Util.EnvironmentTickCountSubtract(m_lastOutgoing) < 1000) | ||
5186 | { | ||
5187 | health+=1; | ||
5188 | flags |= 4; | ||
5189 | } | ||
4937 | else | 5190 | else |
5191 | { | ||
5192 | int pid = System.Diagnostics.Process.GetCurrentProcess().Id; | ||
5193 | System.Diagnostics.Process proc = new System.Diagnostics.Process(); | ||
5194 | proc.EnableRaisingEvents=false; | ||
5195 | proc.StartInfo.FileName = "/bin/kill"; | ||
5196 | proc.StartInfo.Arguments = "-QUIT " + pid.ToString(); | ||
5197 | proc.Start(); | ||
5198 | proc.WaitForExit(); | ||
5199 | Thread.Sleep(1000); | ||
5200 | Environment.Exit(1); | ||
5201 | } | ||
5202 | |||
5203 | if (flags != 7) | ||
4938 | return health; | 5204 | return health; |
4939 | 5205 | ||
4940 | // A login in the last 4 mins? We can't be doing too badly | 5206 | // A login in the last 4 mins? We can't be doing too badly |
4941 | // | 5207 | // |
4942 | if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000) | 5208 | if (Util.EnvironmentTickCountSubtract(m_LastLogin) < 240000) |
4943 | health++; | 5209 | health++; |
4944 | else | 5210 | else |
4945 | return health; | 5211 | return health; |
4946 | 5212 | ||
4947 | // CheckHeartbeat(); | ||
4948 | |||
4949 | return health; | 5213 | return health; |
4950 | } | 5214 | } |
4951 | 5215 | ||
@@ -5033,7 +5297,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5033 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); | 5297 | bool wasUsingPhysics = ((jointProxyObject.Flags & PrimFlags.Physics) != 0); |
5034 | if (wasUsingPhysics) | 5298 | if (wasUsingPhysics) |
5035 | { | 5299 | { |
5036 | 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 | 5300 | 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 |
5037 | } | 5301 | } |
5038 | } | 5302 | } |
5039 | 5303 | ||
@@ -5132,14 +5396,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5132 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; | 5396 | return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; |
5133 | } | 5397 | } |
5134 | 5398 | ||
5135 | // private void CheckHeartbeat() | 5399 | private void CheckHeartbeat() |
5136 | // { | 5400 | { |
5137 | // if (m_firstHeartbeat) | 5401 | if (m_firstHeartbeat) |
5138 | // return; | 5402 | return; |
5139 | // | 5403 | |
5140 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick) > 2000) | 5404 | if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) > 5000) |
5141 | // StartTimer(); | 5405 | Start(); |
5142 | // } | 5406 | } |
5143 | 5407 | ||
5144 | public override ISceneObject DeserializeObject(string representation) | 5408 | public override ISceneObject DeserializeObject(string representation) |
5145 | { | 5409 | { |
@@ -5151,9 +5415,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
5151 | get { return m_allowScriptCrossings; } | 5415 | get { return m_allowScriptCrossings; } |
5152 | } | 5416 | } |
5153 | 5417 | ||
5154 | public Vector3? GetNearestAllowedPosition(ScenePresence avatar) | 5418 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar) |
5155 | { | 5419 | { |
5156 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 5420 | return GetNearestAllowedPosition(avatar, null); |
5421 | } | ||
5422 | |||
5423 | public Vector3 GetNearestAllowedPosition(ScenePresence avatar, ILandObject excludeParcel) | ||
5424 | { | ||
5425 | ILandObject nearestParcel = GetNearestAllowedParcel(avatar.UUID, avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, excludeParcel); | ||
5157 | 5426 | ||
5158 | if (nearestParcel != null) | 5427 | if (nearestParcel != null) |
5159 | { | 5428 | { |
@@ -5162,10 +5431,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5162 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5431 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5163 | if (nearestPoint != null) | 5432 | if (nearestPoint != null) |
5164 | { | 5433 | { |
5165 | // m_log.DebugFormat( | 5434 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); |
5166 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
5167 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
5168 | |||
5169 | return nearestPoint.Value; | 5435 | return nearestPoint.Value; |
5170 | } | 5436 | } |
5171 | 5437 | ||
@@ -5175,17 +5441,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
5175 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 5441 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
5176 | if (nearestPoint != null) | 5442 | if (nearestPoint != null) |
5177 | { | 5443 | { |
5178 | // m_log.DebugFormat( | 5444 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); |
5179 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
5180 | |||
5181 | return nearestPoint.Value; | 5445 | return nearestPoint.Value; |
5182 | } | 5446 | } |
5183 | 5447 | ||
5184 | //Ultimate backup if we have no idea where they are | 5448 | ILandObject dest = LandChannel.GetLandObject(avatar.lastKnownAllowedPosition.X, avatar.lastKnownAllowedPosition.Y); |
5185 | // m_log.DebugFormat( | 5449 | if (dest != excludeParcel) |
5186 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | 5450 | { |
5451 | // Ultimate backup if we have no idea where they are and | ||
5452 | // the last allowed position was in another parcel | ||
5453 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | ||
5454 | return avatar.lastKnownAllowedPosition; | ||
5455 | } | ||
5187 | 5456 | ||
5188 | return avatar.lastKnownAllowedPosition; | 5457 | // else fall through to region edge |
5189 | } | 5458 | } |
5190 | 5459 | ||
5191 | //Go to the edge, this happens in teleporting to a region with no available parcels | 5460 | //Go to the edge, this happens in teleporting to a region with no available parcels |
@@ -5219,13 +5488,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
5219 | 5488 | ||
5220 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) | 5489 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y) |
5221 | { | 5490 | { |
5491 | return GetNearestAllowedParcel(avatarId, x, y, null); | ||
5492 | } | ||
5493 | |||
5494 | public ILandObject GetNearestAllowedParcel(UUID avatarId, float x, float y, ILandObject excludeParcel) | ||
5495 | { | ||
5222 | List<ILandObject> all = AllParcels(); | 5496 | List<ILandObject> all = AllParcels(); |
5223 | float minParcelDistance = float.MaxValue; | 5497 | float minParcelDistance = float.MaxValue; |
5224 | ILandObject nearestParcel = null; | 5498 | ILandObject nearestParcel = null; |
5225 | 5499 | ||
5226 | foreach (var parcel in all) | 5500 | foreach (var parcel in all) |
5227 | { | 5501 | { |
5228 | if (!parcel.IsEitherBannedOrRestricted(avatarId)) | 5502 | if (!parcel.IsEitherBannedOrRestricted(avatarId) && parcel != excludeParcel) |
5229 | { | 5503 | { |
5230 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); | 5504 | float parcelDistance = GetParcelDistancefromPoint(parcel, x, y); |
5231 | if (parcelDistance < minParcelDistance) | 5505 | if (parcelDistance < minParcelDistance) |
@@ -5467,7 +5741,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
5467 | mapModule.GenerateMaptile(); | 5741 | mapModule.GenerateMaptile(); |
5468 | } | 5742 | } |
5469 | 5743 | ||
5470 | private void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | 5744 | // public void CleanDroppedAttachments() |
5745 | // { | ||
5746 | // List<SceneObjectGroup> objectsToDelete = | ||
5747 | // new List<SceneObjectGroup>(); | ||
5748 | // | ||
5749 | // lock (m_cleaningAttachments) | ||
5750 | // { | ||
5751 | // ForEachSOG(delegate (SceneObjectGroup grp) | ||
5752 | // { | ||
5753 | // if (grp.RootPart.Shape.PCode == 0 && grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp))) | ||
5754 | // { | ||
5755 | // UUID agentID = grp.OwnerID; | ||
5756 | // if (agentID == UUID.Zero) | ||
5757 | // { | ||
5758 | // objectsToDelete.Add(grp); | ||
5759 | // return; | ||
5760 | // } | ||
5761 | // | ||
5762 | // ScenePresence sp = GetScenePresence(agentID); | ||
5763 | // if (sp == null) | ||
5764 | // { | ||
5765 | // objectsToDelete.Add(grp); | ||
5766 | // return; | ||
5767 | // } | ||
5768 | // } | ||
5769 | // }); | ||
5770 | // } | ||
5771 | // | ||
5772 | // foreach (SceneObjectGroup grp in objectsToDelete) | ||
5773 | // { | ||
5774 | // m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID); | ||
5775 | // DeleteSceneObject(grp, true); | ||
5776 | // } | ||
5777 | // } | ||
5778 | |||
5779 | public void ThreadAlive(int threadCode) | ||
5780 | { | ||
5781 | switch(threadCode) | ||
5782 | { | ||
5783 | case 1: // Incoming | ||
5784 | m_lastIncoming = Util.EnvironmentTickCount(); | ||
5785 | break; | ||
5786 | case 2: // Incoming | ||
5787 | m_lastOutgoing = Util.EnvironmentTickCount(); | ||
5788 | break; | ||
5789 | } | ||
5790 | } | ||
5791 | |||
5792 | public void RegenerateMaptileAndReregister(object sender, ElapsedEventArgs e) | ||
5471 | { | 5793 | { |
5472 | RegenerateMaptile(); | 5794 | RegenerateMaptile(); |
5473 | 5795 | ||
@@ -5495,6 +5817,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5495 | /// <returns></returns> | 5817 | /// <returns></returns> |
5496 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) | 5818 | public bool QueryAccess(UUID agentID, Vector3 position, out string reason) |
5497 | { | 5819 | { |
5820 | reason = "You are banned from the region"; | ||
5821 | |||
5498 | if (EntityTransferModule.IsInTransit(agentID)) | 5822 | if (EntityTransferModule.IsInTransit(agentID)) |
5499 | { | 5823 | { |
5500 | reason = "Agent is still in transit from this region"; | 5824 | reason = "Agent is still in transit from this region"; |
@@ -5506,6 +5830,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5506 | return false; | 5830 | return false; |
5507 | } | 5831 | } |
5508 | 5832 | ||
5833 | if (Permissions.IsGod(agentID)) | ||
5834 | { | ||
5835 | reason = String.Empty; | ||
5836 | return true; | ||
5837 | } | ||
5838 | |||
5509 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. | 5839 | // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. |
5510 | // However, the long term fix is to make sure root agent count is always accurate. | 5840 | // However, the long term fix is to make sure root agent count is always accurate. |
5511 | m_sceneGraph.RecalculateStats(); | 5841 | m_sceneGraph.RecalculateStats(); |
@@ -5526,6 +5856,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
5526 | } | 5856 | } |
5527 | } | 5857 | } |
5528 | 5858 | ||
5859 | ScenePresence presence = GetScenePresence(agentID); | ||
5860 | IClientAPI client = null; | ||
5861 | AgentCircuitData aCircuit = null; | ||
5862 | |||
5863 | if (presence != null) | ||
5864 | { | ||
5865 | client = presence.ControllingClient; | ||
5866 | if (client != null) | ||
5867 | aCircuit = client.RequestClientInfo(); | ||
5868 | } | ||
5869 | |||
5870 | // We may be called before there is a presence or a client. | ||
5871 | // Fake AgentCircuitData to keep IAuthorizationModule smiling | ||
5872 | if (client == null) | ||
5873 | { | ||
5874 | aCircuit = new AgentCircuitData(); | ||
5875 | aCircuit.AgentID = agentID; | ||
5876 | aCircuit.firstname = String.Empty; | ||
5877 | aCircuit.lastname = String.Empty; | ||
5878 | } | ||
5879 | |||
5880 | try | ||
5881 | { | ||
5882 | if (!AuthorizeUser(aCircuit, out reason)) | ||
5883 | { | ||
5884 | // m_log.DebugFormat("[SCENE]: Denying access for {0}", agentID); | ||
5885 | return false; | ||
5886 | } | ||
5887 | } | ||
5888 | catch (Exception e) | ||
5889 | { | ||
5890 | m_log.DebugFormat("[SCENE]: Exception authorizing agent: {0} "+ e.StackTrace, e.Message); | ||
5891 | return false; | ||
5892 | } | ||
5893 | |||
5529 | if (position == Vector3.Zero) // Teleport | 5894 | if (position == Vector3.Zero) // Teleport |
5530 | { | 5895 | { |
5531 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) | 5896 | if (!RegionInfo.EstateSettings.AllowDirectTeleport) |
@@ -5554,13 +5919,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
5554 | } | 5919 | } |
5555 | } | 5920 | } |
5556 | } | 5921 | } |
5922 | |||
5923 | float posX = 128.0f; | ||
5924 | float posY = 128.0f; | ||
5925 | |||
5926 | if (!TestLandRestrictions(agentID, out reason, ref posX, ref posY)) | ||
5927 | { | ||
5928 | // m_log.DebugFormat("[SCENE]: Denying {0} because they are banned on all parcels", agentID); | ||
5929 | return false; | ||
5930 | } | ||
5931 | } | ||
5932 | else // Walking | ||
5933 | { | ||
5934 | ILandObject land = LandChannel.GetLandObject(position.X, position.Y); | ||
5935 | if (land == null) | ||
5936 | return false; | ||
5937 | |||
5938 | bool banned = land.IsBannedFromLand(agentID); | ||
5939 | bool restricted = land.IsRestrictedFromLand(agentID); | ||
5940 | |||
5941 | if (banned || restricted) | ||
5942 | return false; | ||
5557 | } | 5943 | } |
5558 | 5944 | ||
5559 | reason = String.Empty; | 5945 | reason = String.Empty; |
5560 | return true; | 5946 | return true; |
5561 | } | 5947 | } |
5562 | 5948 | ||
5563 | /// <summary> | 5949 | public void StartTimerWatchdog() |
5950 | { | ||
5951 | m_timerWatchdog.Interval = 1000; | ||
5952 | m_timerWatchdog.Elapsed += TimerWatchdog; | ||
5953 | m_timerWatchdog.AutoReset = true; | ||
5954 | m_timerWatchdog.Start(); | ||
5955 | } | ||
5956 | |||
5957 | public void TimerWatchdog(object sender, ElapsedEventArgs e) | ||
5958 | { | ||
5959 | CheckHeartbeat(); | ||
5960 | } | ||
5961 | |||
5564 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the | 5962 | /// This method deals with movement when an avatar is automatically moving (but this is distinct from the |
5565 | /// autopilot that moves an avatar to a sit target!. | 5963 | /// autopilot that moves an avatar to a sit target!. |
5566 | /// </summary> | 5964 | /// </summary> |
@@ -5639,6 +6037,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
5639 | return m_SpawnPoint - 1; | 6037 | return m_SpawnPoint - 1; |
5640 | } | 6038 | } |
5641 | 6039 | ||
6040 | private void HandleGcCollect(string module, string[] args) | ||
6041 | { | ||
6042 | GC.Collect(); | ||
6043 | } | ||
6044 | |||
5642 | // Wrappers to get physics modules retrieve assets. Has to be done this way | 6045 | // Wrappers to get physics modules retrieve assets. Has to be done this way |
5643 | // because we can't assign the asset service to physics directly - at the | 6046 | // because we can't assign the asset service to physics directly - at the |
5644 | // time physics are instantiated it's not registered but it will be by | 6047 | // time physics are instantiated it's not registered but it will be by |